[Python-Dev] [ 654866 ] pickle and cPickle not equivalent

Patrick K. O'Brien pobrien@orbtech.com
Wed, 18 Dec 2002 09:41:30 -0600


On Wednesday 18 December 2002 07:34 am, Guido van Rossum wrote:
> > It is, strictly speaking, a bug, since the documentation says that
> > all objects will be recorded in the memo. The question is whether
> > this is a documentation bug (i.e. the documentation is promising
> > too much) or an implementation bug in cPickle.
>
> Doc bug.

Not sure I completely agree, but I'm not trying to pick a fight, either. 
I just wish the following bit from the docs was true, whether pickle or 
cPickle were used, whether the object was first pickled inside some 
container and later pickled on its own, whether the instance was a 
new-style class or an old-style class, etc.:

<quote>
It is possible to make multiple calls to the dump() method of the same 
Pickler instance. These must then be matched to the same number of 
calls to the load() method of the corresponding Unpickler instance. If 
the same object is pickled by multiple dump() calls, the load() will 
all yield references to the same object.
</quote>

The fact that I'm no longer sure whether I'll get back a reference to a 
previously pickle instance or not calls into question whether pickling 
can be the foundation for a reliable Python persistence system. I can't 
help but express my disappointment. Was I really expecting too much 
from pickle/cPickle?

In any case, I've submitted the following documentation bug report on 
SF:

  [ 655802 ] cPickle not always same as pickle

-- 
Patrick K. O'Brien
Orbtech      http://www.orbtech.com/web/pobrien
-----------------------------------------------
"Your source for Python programming expertise."
-----------------------------------------------