[issue11286] Some "trivial" python 2.x pickles fails to load in Python 3.2

Alexander Belopolsky report at bugs.python.org
Wed Feb 23 16:35:25 CET 2011


Alexander Belopolsky <belopolsky at users.sourceforge.net> added the comment:

On Wed, Feb 23, 2011 at 10:22 AM, Antoine Pitrou <report at bugs.python.org> wrote:
..
> Well, a theoretical argument could be made that some codec could return
> a non-empty string when asked to decode an empty bytestring, but I'm not
> sure it has much practical worth :)

I was thinking about that as well.  Note that the opposite is quite
common, for example any encoding that uses BOM will turn empty unicode
string into a non-empty byte string.  I don't think a codec that
decodes b'' into non-empty string exists, but it would be reasonable
for a codec that requires BOM or some other metadata to reject raise
an error on b''.  If we rely on decode(b'') == '', these errors will
go unnoticed.  I am going to prepare a Unpickler_Read() patch with
tests and play with it a little.  It is a good idea to separate
performance optimizations from bug fixes anyways.  If we want to
bypass decode on empty strings, we can do it independently.

----------

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


More information about the Python-bugs-list mailing list