From 6b6f91ec88488e9e1ac71cf5635c79c92beeff0f Mon Sep 17 00:00:00 2001 From: "Miss Islington (bot)" <31488909+miss-islington@users.noreply.github.com> Date: Tue, 9 Jan 2024 12:00:07 +0100 Subject: [3.12] gh-113842: Add missing error check for PyIter_Next() in Python/symtable.c (GH-113843) (GH-113851) (cherry picked from commit fda901a1ff94ea6cc338b74928acdbc5ee165ed7) Co-authored-by: Yan Yanchii --- Python/symtable.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Python/symtable.c b/Python/symtable.c index 70b6eac..a5c6b46 100644 --- a/Python/symtable.c +++ b/Python/symtable.c @@ -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; -- cgit v0.12