[issue8289] multiprocessing.Process.__init__ pickles all arguments
Richard Oudkerk shibt...@gmail.com added the comment: I don't think there is any problem here since you have control over which arguments you pass to __init__. Without a reason why that is not a solution I will eventually close the issue as rejected. -- resolution: - rejected stage: - committed/rejected status: open - pending ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8289 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8289] multiprocessing.Process.__init__ pickles all arguments
Ram Rachum r...@rachum.com added the comment: I opened this issue 2 years ago, and I don't remember it being easily solvable back then. But I've long forgotten what the problems were, and I've lost personal interest in it, so I guess we'll just let it go. -- status: pending - open ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8289 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8289] multiprocessing.Process.__init__ pickles all arguments
Richard Oudkerk shibt...@gmail.com added the comment: OK, I'll close. -- status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8289 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8289] multiprocessing.Process.__init__ pickles all arguments
Richard Oudkerk shibt...@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 rep...@bugs.python.org http://bugs.python.org/issue8289 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8289] multiprocessing.Process.__init__ pickles all arguments
Changes by Ram Rachum cool...@cool-rr.com: -- versions: +Python 3.3 -Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8289 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8289] multiprocessing.Process.__init__ pickles all arguments
Changes by Terry J. Reedy tjre...@udel.edu: -- versions: -Python 2.6, Python 2.7, Python 3.1, Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8289 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8289] multiprocessing.Process.__init__ pickles all arguments
New submission from Ram Rachum cool...@cool-rr.com: Currently, when you create a Process, all arguments you pass to its __init__ get pickled. I understood this is done because arguments to __init__ almost always become attributes to the Process. Like this: def MyProcess(multiprocessing.Process): def __init__(self, whatever): self.whatever = whatever Of course, attributes must be pickled so they can be accessed from the separate process (on Windows). And indeed in most cases all arguments to __init__ become attributes, so this makes sense. But, in some cases you pass in arguments to __init__ that do not become attributes. In my case, __init__ takes an object, and takes some attributes of this object as attributes to itself. The object is unpicklable, but the attributes are. So I had to make some ugly workaround to make the program run. So I think it would be better if Process would be smart enough to pickle only the arguments that get set as attributes. -- components: Library (Lib) messages: 102172 nosy: cool-RR severity: normal status: open title: multiprocessing.Process.__init__ pickles all arguments type: feature request versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8289 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8289] multiprocessing.Process.__init__ pickles all arguments
Ram Rachum cool...@cool-rr.com added the comment: Sorry, I accidentally typed def instead of class in my code sample. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8289 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com