Author cwitty
Recipients cwitty
Date 2009-04-19.19:52:58
SpamBayes Score 4.71106e-08
Marked as misclassified No
Message-id <>
When I try to pickle a recursive tuple (that recurses through a list),
pickle can load the result but cPickle fails with "unpickling stack

(I just downloaded and built Python 2.6.2 on 64-bit x86 Debian testing
to verify this bug; it also fails on Python 2.5.2 on 32-bit x86 Debian
testing.  I think that probably it doesn't depend on the architecture or
operating system at all.)

Here is the test case.  At the end, cPickle.loads raises an exception;
instead, it should produce an object equivalent to v, like pickle.loads
does.  (I didn't show it in the test case, but pickles produced by
pickle.dumps have the same behavior -- they work with pickle.loads but
not cPickle.loads.)

>>> v = ([],)
>>> v[0].append(v)
>>> import pickle
>>> import cPickle
>>> v
>>> vp = cPickle.dumps(v)
>>> pickle.loads(vp)
>>> cPickle.loads(vp)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
cPickle.UnpicklingError: unpickling stack underflow
Date User Action Args
2009-04-19 19:53:00cwittysetrecipients: + cwitty
2009-04-19 19:53:00cwittysetmessageid: <>
2009-04-19 19:52:59cwittylinkissue5794 messages
2009-04-19 19:52:58cwittycreate