[issue6784] byte/unicode pickle incompatibilities between python2 and python3
Merlijn van Deen
report at bugs.python.org
Sun Feb 19 20:08:10 CET 2012
Merlijn van Deen <valhallasw at gmail.com> added the comment:
OK, this is the pickle.py patch. A new parameter 'bytestr' has been added to both _Pickler and _Unpickler to toggle the pickle.string<=>bytes behaviour:
_Pickler:
IF protocol <= 2 AND bytestr=True
THEN bytes are stored as STRING/SHORT_BINSTRING/BINSTRING
ELSE (the old behaviour; obj for protocol <=2, else BINARY)
_Unpickler:
IF bytestr=True
THEN STRING/SHORT_BINSTRING/BINSTRING are read as bytes
ELSE they are read as str (old behaviour)
I also extracted the decoding stuff from the three string reading functions to a single one.
----------
keywords: +patch
Added file: http://bugs.python.org/file24568/pickle.py.patch
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue6784>
_______________________________________
More information about the Python-bugs-list
mailing list