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 sbt
Recipients alexandre.vassalotti, irmen, meador.inge, pitrou, sbt
Date 2011-12-09.13:31:16
SpamBayes Score 3.60145e-12
Marked as misclassified No
Message-id <>
> sbt, the bug is not that the encoding is inefficient. The problem is we 
> cannot unpickle bytes streams from Python 3 using Python 2.

Ah.  Well you can do it using codecs.encode.

Python 3.3.0a0 (default, Dec  8 2011, 17:56:13) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pickle, codecs
>>> class MyBytes(bytes):
...     def __reduce__(self):
...         return codecs.encode, (self.decode('latin1'), 'latin1')
>>> pickle.dumps(MyBytes(b"hello"), 2)

Actually, I notice that array objects created by Python 3 are not decodable on Python 2.  See Issue 13566.
Date User Action Args
2011-12-09 13:31:17sbtsetrecipients: + sbt, irmen, pitrou, alexandre.vassalotti, meador.inge
2011-12-09 13:31:17sbtsetmessageid: <>
2011-12-09 13:31:16sbtlinkissue13505 messages
2011-12-09 13:31:16sbtcreate