[issue22005] datetime.__setstate__ fails decoding python2 pickle

Gregory P. Smith report at bugs.python.org
Sun Dec 9 14:50:36 EST 2018


Gregory P. Smith <greg at krypto.org> added the comment:

It is fundamentally impossible for pickled data to magically cross the 2 and 3 language boundary unscathed.

The basic str/bytes/unicode types in the language changed meaning.  Code must be written manually by the data owners to fix that up based on what the types and encodings should actually be in various places given the language version the data is being read into.

The code in the PRs for this bug appears to do that in the requisite required hacky manner for stored datetime instances.

This fact isn't new.  It happened 10 years ago with the release of Python 3.0.  The documentation is not a contract.  I'm fixing it to mention this.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue22005>
_______________________________________


More information about the Python-bugs-list mailing list