]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.12] gh-113842: Add missing error check for PyIter_Next() in Python/symtable.c...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Tue, 9 Jan 2024 11:00:07 +0000 (12:00 +0100)
committerGitHub <noreply@github.com>
Tue, 9 Jan 2024 11:00:07 +0000 (11:00 +0000)
(cherry picked from commit fda901a1ff94ea6cc338b74928acdbc5ee165ed7)

Co-authored-by: Yan Yanchii <yyanchiy@gmail.com>
Python/symtable.c

index 70b6eacd4ac0715ea02473c5a40a3a82d9d91978..a5c6b465b71ddddd9f938b28e7208736f4409f51 100644 (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;