diff options
author | Fred Drake <fdrake@acm.org> | 2002-11-27 05:26:46 (GMT) |
---|---|---|
committer | Fred Drake <fdrake@acm.org> | 2002-11-27 05:26:46 (GMT) |
commit | e9cfcef71eec755ad38a0764336920ecebb76344 (patch) | |
tree | 203110e60c559df9ab9b6be275f8ee18dc325891 /Doc | |
parent | a01fa26396472808e9442e3a80c991f23a29a18b (diff) | |
download | cpython-e9cfcef71eec755ad38a0764336920ecebb76344.zip cpython-e9cfcef71eec755ad38a0764336920ecebb76344.tar.gz cpython-e9cfcef71eec755ad38a0764336920ecebb76344.tar.bz2 |
Clarify the interpretation of the __getstate__() return value for
new-style classes.
Closes SF bug #637941.
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/lib/libpickle.tex | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/Doc/lib/libpickle.tex b/Doc/lib/libpickle.tex index 959225d..f72dcb0 100644 --- a/Doc/lib/libpickle.tex +++ b/Doc/lib/libpickle.tex @@ -412,13 +412,19 @@ Upon unpickling, if the class also defines the method \method{__setstate__()}, it is called with the unpickled state\footnote{These methods can also be used to implement copying class instances.}. If there is no \method{__setstate__()} method, the -pickled object must be a dictionary and its items are assigned to the +pickled state must be a dictionary and its items are assigned to the new instance's dictionary. If a class defines both \method{__getstate__()} and \method{__setstate__()}, the state object needn't be a dictionary and these methods can do what they -want\footnote{This protocol is also used by the shallow and deep +want.\footnote{This protocol is also used by the shallow and deep copying operations defined in the -\refmodule{copy} module.}. +\refmodule{copy} module.} + +\begin{notice}[warning] + For new-style classes, if \method{__getstate__()} returns a false + value, the \method{__setstate__()} method will not be called. +\end{notice} + \subsubsection{Pickling and unpickling extension types} |