mirror of
https://github.com/python/cpython.git
synced 2026-02-13 19:04:37 +00:00
[3.14] GH-140058: Clear key and value if PyTuple_New fails in dictiter_iternextitem (GH-140059) (#140107)
GH-140058: Clear key and value if `PyTuple_New` fails in `dictiter_iternextitem` (GH-140059)
(cherry picked from commit ded59f7e8e)
Co-authored-by: Sergey Miryanov <sergey.miryanov@gmail.com>
This commit is contained in:
parent
45577c93de
commit
2142f4efcf
1 changed files with 4 additions and 1 deletions
|
|
@ -5670,8 +5670,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