Eliminate the deprecated option to return None instead of a tuple of arguments in __reduce__().

This commit is contained in:
Raymond Hettinger 2004-12-07 07:05:57 +00:00
parent 84667c063a
commit a6b45cc31d
4 changed files with 16 additions and 33 deletions

View file

@ -2143,6 +2143,12 @@ save_reduce(Picklerobject *self, PyObject *args, PyObject *ob)
&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)
@ -3616,17 +3622,6 @@ Instance_New(PyObject *cls, PyObject *args)
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: