unpickling environment. Note that as usual, the callable itself is
pickled by name.
-\item A tuple of arguments for the callable object, or \code{None}.
-\deprecated{2.3}{If this item is \code{None}, then instead of calling
-the callable directly, its \method{__basicnew__()} method is called
-without arguments; this method should also return the unpickled
-object. Providing \code{None} is deprecated, however; return a
-tuple of arguments instead.}
+\item A tuple of arguments for the callable object.
+\versionchanged[Formerly, this argument could also be \code{None}]{2.5}
\item Optionally, the object's state, which will be passed to
the object's \method{__setstate__()} method as described in
import sys
import struct
import re
-import warnings
__all__ = ["PickleError", "PicklingError", "UnpicklingError", "Pickler",
"Unpickler", "dump", "dumps", "load", "loads"]
# Assert that args is a tuple or None
if not isinstance(args, TupleType):
- if args is None:
- # A hack for Jim Fulton's ExtensionClass, now deprecated.
- # See load_reduce()
- warnings.warn("__basicnew__ special case is deprecated",
- DeprecationWarning)
- else:
- raise PicklingError(
- "args from reduce() should be a tuple")
+ raise PicklingError("args from reduce() should be a tuple")
# Assert that func is callable
if not callable(func):
stack = self.stack
args = stack.pop()
func = stack[-1]
- if args is None:
- # A hack for Jim Fulton's ExtensionClass, now deprecated
- warnings.warn("__basicnew__ special case is deprecated",
- DeprecationWarning)
- value = func.__basicnew__()
- else:
- value = func(*args)
+ value = func(*args)
stack[-1] = value
dispatch[REDUCE] = load_reduce
Extension Modules
-----------------
+- the cPickle module no longer accepts the deprecated None option in the
+ args tuple returned by __reduce__().
+
- itertools.islice() now accepts None for the start and step arguments.
This allows islice() to work more readily with slices:
islice(s.start, s.stop, s.step)
Library
-------
+- the pickle module no longer accepts the deprecated None option in the
+ args tuple returned by __reduce__().
+
- optparse now optionally imports gettext. This allows its use in setup.py.
- the deprecated tzparse module was removed.
&dictitems))
return -1;
+ if (!PyTuple_Check(argtup)) {
+ PyErr_SetString(PicklingError,
+ "args from reduce() should be a tuple");
+ return -1;
+ }
+
if (state == Py_None)
state = NULL;
if (listitems == Py_None)
else goto err;
}
- if (args==Py_None) {
- /* Special case, call cls.__basicnew__() */
- PyObject *basicnew;
-
- basicnew = PyObject_GetAttr(cls, __basicnew___str);
- if (!basicnew) return NULL;
- r=PyObject_CallObject(basicnew, NULL);
- Py_DECREF(basicnew);
- if (r) return r;
- }
-
if ((r=PyObject_CallObject(cls, args))) return r;
err: