summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2024-01-09 11:00:07 (GMT)
committerGitHub <noreply@github.com>2024-01-09 11:00:07 (GMT)
commit6b6f91ec88488e9e1ac71cf5635c79c92beeff0f (patch)
tree3719ac0d76126d9184601e51d752898ba18afd1d /Python
parent7e894a4baf80a13d7f23071f2e417bed8a2a3a1d (diff)
downloadcpython-6b6f91ec88488e9e1ac71cf5635c79c92beeff0f.zip
cpython-6b6f91ec88488e9e1ac71cf5635c79c92beeff0f.tar.gz
cpython-6b6f91ec88488e9e1ac71cf5635c79c92beeff0f.tar.bz2
[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 <yyanchiy@gmail.com>
Diffstat (limited to 'Python')
-rw-r--r--Python/symtable.c6
1 files changed, 6 insertions, 0 deletions
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;