[3.12] gh-113842: Add missing error check for PyIter_Next() in Python/symtable.c (GH-113843) (GH-113851)

(cherry picked from commit fda901a1ff)

Co-authored-by: Yan Yanchii <yyanchiy@gmail.com>
This commit is contained in:
Miss Islington (bot) 2024-01-09 12:00:07 +01:00 committed by GitHub
parent 7e894a4baf
commit 6b6f91ec88
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -872,6 +872,12 @@ update_symbols(PyObject *symbols, PyObject *scopes,
}
Py_DECREF(name);
}
/* Check if loop ended because of exception in PyIter_Next */
if (PyErr_Occurred()) {
goto error;
}
Py_DECREF(itr);
Py_DECREF(v_free);
return 1;