This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author belopolsky
Recipients alexandre.vassalotti, belopolsky, lemburg, pitrou
Date 2010-06-28.00:43:07
SpamBayes Score 1.7569698e-07
Marked as misclassified No
Message-id <>
It looks like I was able to get to the root of the problem.  I am attaching two files that demonstrate the issue:

==> <==
import pickle
import sys
class Bug:
bug = Bug()
f = open(sys.argv[1], 'w')
pickle.Pickler(f, protocol=0).dump(bug)

==> <==
import pickle
import sys
class Bug:
bug = pickle._Unpickler(open(sys.argv[1], 'rb')).load() # works
bug = pickle.Unpickler(open(sys.argv[1], 'rb')).load() # doesn't

$ python2 /tmp/bug.pkl
$ python3 /tmp/bug.pkl
<__main__.Bug object at 0x1006b6f40>
Traceback (most recent call last):
  File "", 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:11belopolskysetrecipients: + belopolsky, lemburg, pitrou, alexandre.vassalotti
2010-06-28 00:43:10belopolskysetmessageid: <>
2010-06-28 00:43:09belopolskylinkissue5180 messages
2010-06-28 00:43:08belopolskycreate