Skip to content

Commit

Permalink
gh-128198: Add missing error checks for usages of PyIter_Next() (GH-1…
Browse files Browse the repository at this point in the history
  • Loading branch information
WolframAlph authored Dec 25, 2024
1 parent 81636d3 commit 5c814c8
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
13 changes: 13 additions & 0 deletions Modules/_asynciomodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}

Expand Down
4 changes: 4 additions & 0 deletions Objects/frameobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,10 @@ framelocalsproxy_merge(PyObject* self, PyObject* other)

Py_DECREF(iter);

if (PyErr_Occurred()) {
return -1;
}

return 0;
}

Expand Down
4 changes: 4 additions & 0 deletions Objects/namespaceobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,10 @@ namespace_repr(PyObject *ns)
goto error;
}

if (PyErr_Occurred()) {
goto error;
}

separator = PyUnicode_FromString(", ");
if (separator == NULL)
goto error;
Expand Down

0 comments on commit 5c814c8

Please sign in to comment.