Eryk Sun added the comment:
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.
----------
nosy: +eryksun
versions: -Python 3.3
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue27649>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com