]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Clarify the interpretation of the __getstate__() return value for
authorFred Drake <fdrake@acm.org>
Wed, 27 Nov 2002 05:26:24 +0000 (05:26 +0000)
committerFred Drake <fdrake@acm.org>
Wed, 27 Nov 2002 05:26:24 +0000 (05:26 +0000)
new-style classes.
Closes SF bug #637941.

Doc/lib/libpickle.tex

index 912d27b20fd1e1316f5616d79bb22fe5e58b5d32..3f4151bac15b21875cbd0458f46c1984fb788c26 100644 (file)
@@ -406,13 +406,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}