mirror of
https://github.com/python/cpython.git
synced 2025-09-27 10:50:04 +00:00
repair my irrational excuberance
This commit is contained in:
parent
99e96f2bb0
commit
0718de9770
1 changed files with 62 additions and 59 deletions
|
@ -2411,7 +2411,7 @@ mutablemapping_update(PyObject *self, PyObject *args, PyObject *kwargs)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (len == 1) {
|
||||||
PyObject *other = PyTuple_GET_ITEM(args, 0); /* borrowed reference */
|
PyObject *other = PyTuple_GET_ITEM(args, 0); /* borrowed reference */
|
||||||
if (other == NULL)
|
if (other == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -2461,11 +2461,13 @@ mutablemapping_update(PyObject *self, PyObject *args, PyObject *kwargs)
|
||||||
if (res != 0)
|
if (res != 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* now handle kwargs */
|
/* now handle kwargs */
|
||||||
len = (kwargs != NULL) ? PyObject_Size(kwargs) : 0;
|
len = (kwargs != NULL) ? PyObject_Size(kwargs) : 0;
|
||||||
if (len < 0) /* PyObject_Size raised an exception. */
|
if (len < 0) /* PyObject_Size raised an exception. */
|
||||||
return NULL;
|
return NULL;
|
||||||
|
if (len > 0) {
|
||||||
PyObject *items;
|
PyObject *items;
|
||||||
if (!PyMapping_Check(kwargs)) {
|
if (!PyMapping_Check(kwargs)) {
|
||||||
PyErr_SetString(PyExc_TypeError, "expected mapping for kwargs");
|
PyErr_SetString(PyExc_TypeError, "expected mapping for kwargs");
|
||||||
|
@ -2478,6 +2480,7 @@ mutablemapping_update(PyObject *self, PyObject *args, PyObject *kwargs)
|
||||||
Py_DECREF(items);
|
Py_DECREF(items);
|
||||||
if (res == -1)
|
if (res == -1)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue