From: Yan Yanchii Date: Wed, 25 Dec 2024 17:42:04 +0000 (+0100) Subject: gh-128198: Add missing error checks for usages of PyIter_Next() (GH-128199) X-Git-Tag: v3.14.0a4~195 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5c814c83cdd3dc42bd9682106ffb7ade7ce6b5b3;p=thirdparty%2FPython%2Fcpython.git gh-128198: Add missing error checks for usages of PyIter_Next() (GH-128199) --- diff --git a/Modules/_asynciomodule.c b/Modules/_asynciomodule.c index 603b77a70b15..74db4c74af90 100644 --- a/Modules/_asynciomodule.c +++ b/Modules/_asynciomodule.c @@ -3599,6 +3599,13 @@ _asyncio_all_tasks_impl(PyObject *module, PyObject *loop) Py_DECREF(item); } Py_DECREF(eager_iter); + + if (PyErr_Occurred()) { + Py_DECREF(tasks); + Py_DECREF(loop); + return NULL; + } + int err = 0; ASYNCIO_STATE_LOCK(state); struct llist_node *node; @@ -3636,6 +3643,12 @@ _asyncio_all_tasks_impl(PyObject *module, PyObject *loop) } Py_DECREF(scheduled_iter); Py_DECREF(loop); + + if (PyErr_Occurred()) { + Py_DECREF(tasks); + return NULL; + } + return tasks; } diff --git a/Objects/frameobject.c b/Objects/frameobject.c index 10fd3a982c36..4f0040df4f30 100644 --- a/Objects/frameobject.c +++ b/Objects/frameobject.c @@ -264,6 +264,10 @@ framelocalsproxy_merge(PyObject* self, PyObject* other) Py_DECREF(iter); + if (PyErr_Occurred()) { + return -1; + } + return 0; } diff --git a/Objects/namespaceobject.c b/Objects/namespaceobject.c index 5b7547103a2b..4ef3bd92f5a5 100644 --- a/Objects/namespaceobject.c +++ b/Objects/namespaceobject.c @@ -141,6 +141,10 @@ namespace_repr(PyObject *ns) goto error; } + if (PyErr_Occurred()) { + goto error; + } + separator = PyUnicode_FromString(", "); if (separator == NULL) goto error;