Skip to content

Commit 6b6f91e

Browse files
[3.12] gh-113842: Add missing error check for PyIter_Next() in Python/symtable.c (GH-113843) (GH-113851)
(cherry picked from commit fda901a) Co-authored-by: Yan Yanchii <[email protected]>
1 parent 7e894a4 commit 6b6f91e

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Python/symtable.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -872,6 +872,12 @@ update_symbols(PyObject *symbols, PyObject *scopes,
872872
}
873873
Py_DECREF(name);
874874
}
875+
876+
/* Check if loop ended because of exception in PyIter_Next */
877+
if (PyErr_Occurred()) {
878+
goto error;
879+
}
880+
875881
Py_DECREF(itr);
876882
Py_DECREF(v_free);
877883
return 1;

0 commit comments

Comments
 (0)