New submission from Ram Rachum <[email protected]>:
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 <[email protected]>
<http://bugs.python.org/issue8289>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com