Antoine Pitrou <[email protected]> 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 <[email protected]>
<http://bugs.python.org/issue13735>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com