Message108812
It looks like I was able to get to the root of the problem. I am attaching two files that demonstrate the issue:
==> pickle-bug.py <==
import pickle
import sys
class Bug:
pass
bug = Bug()
f = open(sys.argv[1], 'w')
pickle.Pickler(f, protocol=0).dump(bug)
f.close()
==> unpickle-bug.py <==
import pickle
import sys
class Bug:
pass
bug = pickle._Unpickler(open(sys.argv[1], 'rb')).load() # works
print(bug)
bug = pickle.Unpickler(open(sys.argv[1], 'rb')).load() # doesn't
print(bug)
$ python2 pickle-bug.py /tmp/bug.pkl
$ python3 unpickle-bug.py /tmp/bug.pkl
<__main__.Bug object at 0x1006b6f40>
Traceback (most recent call last):
File "unpickle-bug.py", line 7, in <module>
bug = pickle.Unpickler(open(sys.argv[1], 'rb')).load() # doesn't
_pickle.UnpicklingError: bad pickle data
The problematic pickle is really small, so I hope I'll report that I have a fix soon.
0: ( MARK
1: i INST '__main__ Bug' (MARK at 0)
15: p PUT 0
18: ( MARK
19: d DICT (MARK at 18)
20: p PUT 1
23: b BUILD
24: . STOP
highest protocol among opcodes = 0 |
|
Date |
User |
Action |
Args |
2010-06-28 00:43:11 | belopolsky | set | recipients:
+ belopolsky, lemburg, pitrou, alexandre.vassalotti |
2010-06-28 00:43:10 | belopolsky | set | messageid: <1277685790.99.0.096615985495.issue5180@psf.upfronthosting.co.za> |
2010-06-28 00:43:09 | belopolsky | link | issue5180 messages |
2010-06-28 00:43:08 | belopolsky | create | |
|