[issue13735] The protocol > 0 of cPickle does not given stable dictionary values
Antoine Pitrou
report at bugs.python.org
Sun Jan 8 19:49:25 CET 2012
Antoine Pitrou <pitrou at free.fr> added the comment:
I think the "premature" optimization comes down to that code:
"""
static int
put(Picklerobject *self, PyObject *ob)
{
if (Py_REFCNT(ob) < 2 || self->fast)
return 0;
return put2(self, ob);
}
"""
(put2() being the function which emits BINPUT)
When you unpickle a dict, its contents are created anew and therefore the refcount is 1 => next pickling avoids emitting a BINPUT.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13735>
_______________________________________
More information about the Python-bugs-list
mailing list