19 May 2013 20:41
[issue18015] python 2.7.5 fails to unpickle namedtuple pickled by 2.7.3 or 2.7.4
Anselm Kruis <report <at> bugs.python.org>
2013-05-19 18:41:59 GMT
2013-05-19 18:41:59 GMT
New submission from Anselm Kruis:
Change 18303391b981 breaks unpickling named tuples pickled by 2.7.3 and 2.7.4.
See closed issue #15535 for the full story. Unfortunately Raymond was wrong, when he wrote that the
addition of __dict__ was a 2.7.4 change. It was added by changeset 26d5f022eb1a in 2.7.3.
Now 2.7.5 can't unpickle any named tuples pickled by 2.7.3, which is probably one of the most widely used
python versions.
Example:
Pickle a namd tuple using 2.7.3 and unpickle it using 2.7.5.
anselm <at> Emmy:~$ python2.7
Python 2.7.3 (default, Sep 16 2012, 21:46:37)
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import collections
>>> import pickletools
>>> import pickle
>>> N=collections.namedtuple("N","a")
>>> n=N(1)
>>> p=pickle.dumps(n, 2)
>>> p2=pickletools.optimize(p)
>>> pickletools.dis(p2)
0: \x80 PROTO 2
2: c GLOBAL '__main__ N'
14: K BININT1 1
(Continue reading)
RSS Feed