]> granicus.if.org Git - python/commitdiff
Patch 533291. Deprecate None return form of __reduce__.
authorRaymond Hettinger <python@rcn.com>
Tue, 21 May 2002 17:22:02 +0000 (17:22 +0000)
committerRaymond Hettinger <python@rcn.com>
Tue, 21 May 2002 17:22:02 +0000 (17:22 +0000)
Doc/lib/libpickle.tex
Lib/pickle.py

index d4a54cdbeb6604a6a5cc2b2fee2a9aae14703b89..194a717fc0a9f7e4ad2b973721f4288371d72859 100644 (file)
@@ -444,6 +444,7 @@ or three, with the following semantics:
       by name.
 
 \item A tuple of arguments for the callable object, or \code{None}.
+\deprecated{2.3}{Use the tuple of arguments instead}                                                           
 
 \item Optionally, the object's state, which will be passed to
       the object's \method{__setstate__()} method as described in
@@ -456,10 +457,13 @@ or three, with the following semantics:
 
 Upon unpickling, the callable will be called (provided that it meets
 the above criteria), passing in the tuple of arguments; it should
-return the unpickled object.  If the second item was \code{None}, then
-instead of calling the callable directly, its \method{__basicnew__()}
-method is called without arguments.  It should also return the
-unpickled object.
+return the unpickled object.
+
+If the second item was \code{None}, then instead of calling the
+callable directly, its \method{__basicnew__()} method is called
+without arguments.  It should also return the unpickled object.
+
+\deprecated{2.3}{Use the tuple of arguments instead}
 
 An alternative to implementing a \method{__reduce__()} method on the
 object to be pickled, is to register the callable with the
index 5837884e178a1d881610d792fc425f064ebefdd1..d24786aaf91a570959aaeb04e7530bd9ad89951b 100644 (file)
@@ -862,6 +862,10 @@ class Unpickler:
                                            "unpickling" % callable
 
         if arg_tup is None:
+            import warnings
+            warnings.warn("The None return argument form of __reduce__  is "
+                          "deprecated. Return a tuple of arguments instead.",
+                          DeprecationWarning)            
             value = callable.__basicnew__()
         else:
             value = apply(callable, arg_tup)