Author eryksun
Recipients eryksun, icordasc, paul.moore, steve.dower, tim.golden, zach.ware
Date 2016-07-29.13:51:42
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1469800302.41.0.2413935932.issue27649@psf.upfronthosting.co.za>
In-reply-to
Content
Queuing the class doesn't do anything here. It gets pickled as a module attribute; the queue isn't marshaling the class dict. For example:

    >>> pickletools.dis(pickle.dumps(mccabe.McCabeChecker))
        0: \x80 PROTO      3
        2: c    GLOBAL     'mccabe McCabeChecker'
       24: q    BINPUT     0
       26: .    STOP
    highest protocol among opcodes = 2

Unpickling this is basically getattr(sys.modules['mccabe'], 'McCabeChecker'). So you'll see the same result if you only put ('max_complexity', 10) in the queue and hard code the class in the _target function. 

Of course for a system that uses fork() the class attribute is the same in the child process. In 3.4+ you can force spawning by initially calling multiprocessing.set_start_method('spawn'). Then you'll see the same result as in Windows.
History
Date User Action Args
2016-07-29 13:51:42eryksunsetrecipients: + eryksun, paul.moore, tim.golden, zach.ware, steve.dower, icordasc
2016-07-29 13:51:42eryksunsetmessageid: <1469800302.41.0.2413935932.issue27649@psf.upfronthosting.co.za>
2016-07-29 13:51:42eryksunlinkissue27649 messages
2016-07-29 13:51:42eryksuncreate