mirror of
https://github.com/python/cpython.git
synced 2025-08-02 08:02:56 +00:00
Eliminate the deprecated option to return None instead of a tuple of arguments in __reduce__().
This commit is contained in:
parent
84667c063a
commit
a6b45cc31d
4 changed files with 16 additions and 33 deletions
|
@ -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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue