]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-113842: Add missing error check for PyIter_Next() in Python/symtable.c (GH-113843)
authorYan Yanchii <yyanchiy@gmail.com>
Tue, 9 Jan 2024 10:43:58 +0000 (11:43 +0100)
committerGitHub <noreply@github.com>
Tue, 9 Jan 2024 10:43:58 +0000 (12:43 +0200)
Python/symtable.c

index 52d5932896b263e4d1358b13c63636867c9adcdd..83137b491f282cb9e074b1504b74644a74ac3d34 100644 (file)
@@ -977,6 +977,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;