mirror of
https://github.com/python/cpython.git
synced 2025-12-10 11:00:14 +00:00
Minor cleanup.
This commit is contained in:
parent
6908265812
commit
28c995d03b
1 changed files with 3 additions and 3 deletions
|
|
@ -2167,13 +2167,13 @@ _count_elements(PyObject *self, PyObject *args)
|
||||||
|
|
||||||
oldval = _PyDict_GetItem_KnownHash(mapping, key, hash);
|
oldval = _PyDict_GetItem_KnownHash(mapping, key, hash);
|
||||||
if (oldval == NULL) {
|
if (oldval == NULL) {
|
||||||
if (_PyDict_SetItem_KnownHash(mapping, key, one, hash) == -1)
|
if (_PyDict_SetItem_KnownHash(mapping, key, one, hash) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
} else {
|
} else {
|
||||||
newval = PyNumber_Add(oldval, one);
|
newval = PyNumber_Add(oldval, one);
|
||||||
if (newval == NULL)
|
if (newval == NULL)
|
||||||
goto done;
|
goto done;
|
||||||
if (_PyDict_SetItem_KnownHash(mapping, key, newval, hash) == -1)
|
if (_PyDict_SetItem_KnownHash(mapping, key, newval, hash) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
Py_CLEAR(newval);
|
Py_CLEAR(newval);
|
||||||
}
|
}
|
||||||
|
|
@ -2199,7 +2199,7 @@ _count_elements(PyObject *self, PyObject *args)
|
||||||
Py_DECREF(oldval);
|
Py_DECREF(oldval);
|
||||||
if (newval == NULL)
|
if (newval == NULL)
|
||||||
break;
|
break;
|
||||||
if (PyObject_SetItem(mapping, key, newval) == -1)
|
if (PyObject_SetItem(mapping, key, newval) < 0)
|
||||||
break;
|
break;
|
||||||
Py_CLEAR(newval);
|
Py_CLEAR(newval);
|
||||||
Py_DECREF(key);
|
Py_DECREF(key);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue