mirror of
https://github.com/python/cpython.git
synced 2025-11-24 12:20:42 +00:00
GH-140058: Clear key and value if PyTuple_New fails in dictiter_iternextitem (#140059)
This commit is contained in:
parent
6ecf77dbde
commit
ded59f7e8e
1 changed files with 4 additions and 1 deletions
|
|
@ -5719,8 +5719,11 @@ dictiter_iternextitem(PyObject *self)
|
|||
}
|
||||
else {
|
||||
result = PyTuple_New(2);
|
||||
if (result == NULL)
|
||||
if (result == NULL) {
|
||||
Py_DECREF(key);
|
||||
Py_DECREF(value);
|
||||
return NULL;
|
||||
}
|
||||
PyTuple_SET_ITEM(result, 0, key);
|
||||
PyTuple_SET_ITEM(result, 1, value);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue