[issue8289] multiprocessing.Process.__init__ pickles all arguments
Richard Oudkerk
report at bugs.python.org
Fri Jun 8 14:46:22 CEST 2012
Richard Oudkerk <shibturn at gmail.com> added the comment:
As long as you don't pass the arguments on to Process.__init__() when you call it there should be no problem.
The following program works, but will fail with RuntimeError if you uncomment the comment line:
from multiprocessing import Process
class Unpicklable(object):
def __reduce__(self):
raise RuntimeError
class MyProcess(Process):
def __init__(self, foo, unpicklable_bar):
Process.__init__(self,
#args=(foo, unpicklable_bar)
)
self.foo = foo
self.baz = str(unpicklable_bar)
def run(self):
print(self.foo)
print(self.baz)
if __name__ == '__main__':
p = MyProcess([1,2,3], Unpicklable())
p.start()
p.join()
----------
nosy: +sbt
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue8289>
_______________________________________
More information about the Python-bugs-list
mailing list