This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author cool-RR
Recipients cool-RR
Date 2011-05-01.13:25:54
SpamBayes Score 2.6718683e-11
Marked as misclassified No
Message-id <1304256356.26.0.816198245723.issue11969@psf.upfronthosting.co.za>
In-reply-to
Content
Hello,

I found this bit in my inbox, I forgot why I cared about it, but it raises an exception (at least on Windows):

>>> import multiprocessing
>>> p = multiprocessing.Process(target=bytes.maketrans, args=(b'abc', b'xyz'))
>>> p.start()
Traceback (most recent call last):
  File "C:\Python32\Lib\pickle.py", line 679, in save_global
    klass = getattr(mod, name)
AttributeError: 'module' object has no attribute 'maketrans'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python32\Lib\multiprocessing\process.py", line 130, in start
    self._popen = Popen(self)
  File "C:\Python32\Lib\multiprocessing\forking.py", line 267, in __init__
    dump(process_obj, to_child, HIGHEST_PROTOCOL)
  File "C:\Python32\Lib\multiprocessing\forking.py", line 190, in dump
    ForkingPickler(file, protocol).dump(obj)
  File "C:\Python32\Lib\pickle.py", line 237, in dump
    self.save(obj)
  File "C:\Python32\Lib\pickle.py", line 344, in save
    self.save_reduce(obj=obj, *rv)
  File "C:\Python32\Lib\pickle.py", line 432, in save_reduce
    save(state)
  File "C:\Python32\Lib\pickle.py", line 299, in save
    f(self, obj) # Call unbound method with explicit self
  File "C:\Python32\Lib\pickle.py", line 623, in save_dict
    self._batch_setitems(obj.items())
  File "C:\Python32\Lib\pickle.py", line 656, in _batch_setitems
    save(v)
  File "C:\Python32\Lib\pickle.py", line 299, in save
    f(self, obj) # Call unbound method with explicit self
  File "C:\Python32\Lib\pickle.py", line 683, in save_global
    (obj, module, name))
_pickle.PicklingError: Can't pickle <built-in function maketrans>: it's not found as __main__.maketrans

If you do the same things with `threading.Thread`, it works, but for `multiprocessing.Process` it doesn't. Is this a general problem with pickling "unbound methods"?
History
Date User Action Args
2011-05-01 13:25:56cool-RRsetrecipients: + cool-RR
2011-05-01 13:25:56cool-RRsetmessageid: <1304256356.26.0.816198245723.issue11969@psf.upfronthosting.co.za>
2011-05-01 13:25:55cool-RRlinkissue11969 messages
2011-05-01 13:25:54cool-RRcreate