diff --git a/Modules/_asynciomodule.c b/Modules/_asynciomodule.c index 27c16364457336..f212d8169cc177 100644 --- a/Modules/_asynciomodule.c +++ b/Modules/_asynciomodule.c @@ -3623,6 +3623,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); TaskObj *first = &state->asyncio_tasks.first; @@ -3662,6 +3669,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 10fd3a982c36f4..4f0040df4f3017 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 5b7547103a2b3f..4ef3bd92f5a569 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;