[issue8323] buffer objects are picklable but result is not unpicklable

sbt report at bugs.python.org
Mon Aug 29 17:26:22 CEST 2011


sbt <shibturn at gmail.com> added the comment:

Buffer objects *are* picklable with protocol 2 (but not with earlier protocols).  Unfortunately, the result is not unpicklable.  

This is not a problem with multiprocessing.  (buffer seems to inherit __reduce__ and __reduce_ex__ from object.)

Python 2.7.1+ (r271:86832, Apr 11 2011, 18:13:53) 
[GCC 4.5.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import cPickle
>>> cPickle.dumps(buffer("hello"), cPickle.HIGHEST_PROTOCOL)
'\x80\x02c__builtin__\nbuffer\nq\x01)\x81q\x02.'
>>> cPickle.loads(_)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: buffer() takes at least 1 argument (0 given)

----------
nosy: +sbt
title: multiprocessing.Queue ignores pickle restrictions in .put() -> buffer objects are picklable but result is not unpicklable

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue8323>
_______________________________________


More information about the Python-bugs-list mailing list