Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions Modules/_asynciomodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -3623,6 +3623,14 @@ _asyncio_all_tasks_impl(PyObject *module, PyObject *loop)
Py_DECREF(item);
}
Py_DECREF(eager_iter);

/* Check if loop ended because of exception in PyIter_Next */
if (PyErr_Occurred()) {
Py_DECREF(tasks);
Py_DECREF(loop);
return NULL;
}

int err = 0;
ASYNCIO_STATE_LOCK(state);
TaskObj *first = &state->asyncio_tasks.first;
Expand Down Expand Up @@ -3662,6 +3670,12 @@ _asyncio_all_tasks_impl(PyObject *module, PyObject *loop)
}
Py_DECREF(scheduled_iter);
Py_DECREF(loop);

/* Check if loop ended because of exception in PyIter_Next */
if (PyErr_Occurred()) {
return NULL;
}

return tasks;
}

Expand Down
9 changes: 6 additions & 3 deletions Modules/_collectionsmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -1667,10 +1667,13 @@ deque_richcompare(PyObject *v, PyObject *w, int op)
if (it2 == NULL)
goto done;
for (;;) {
x = PyIter_Next(it1);
if (x == NULL && PyErr_Occurred())
if ((x = PyIter_Next(it1)) == NULL && PyErr_Occurred()) {
goto done;
y = PyIter_Next(it2);
}
if ((y = PyIter_Next(it2)) == NULL && PyErr_Occurred()) {
Py_XDECREF(x);
goto done;
}
if (x == NULL || y == NULL)
break;
b = PyObject_RichCompareBool(x, y, Py_EQ);
Expand Down
5 changes: 5 additions & 0 deletions Objects/frameobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,11 @@ framelocalsproxy_merge(PyObject* self, PyObject* other)

Py_DECREF(iter);

/* Check if loop ended because of exception in PyIter_Next */
if (PyErr_Occurred()) {
return -1;
}

return 0;
}

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

/* Check if loop ended because of exception in PyIter_Next */
if (PyErr_Occurred()) {
goto error;
}

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