]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
In save_newobj(), if an object's __getnewargs__ and __getstate__ are
authorGuido van Rossum <guido@python.org>
Thu, 30 Jan 2003 05:39:04 +0000 (05:39 +0000)
committerGuido van Rossum <guido@python.org>
Thu, 30 Jan 2003 05:39:04 +0000 (05:39 +0000)
commit45486176ea14884400188c604d5d3488f803ff2d
tree1d1015f4e7e6ea85999653e054404a8d39399852
parent301eb71fb9fe45eabdf50763a28925c746403100
In save_newobj(), if an object's __getnewargs__ and __getstate__ are
the same function, don't save the state or write a BUILD opcode.  This
is so that a type (e.g. datetime :-) can support protocol 2 using
__getnewargs__ while also supporting protocol 0 and 1 using
__getstate__.  (Without this, the state would be pickled twice with
protocol 2, unless __getstate__ is defined to return None, which
breaks protocol 0 and 1.)
Lib/pickle.py