bpo-40559: Add Py_DECREF to _asynciomodule.c:task_step_impl() (GH-19990) · python/cpython@d2c349b (original) (raw)

Skip to content

Provide feedback

Saved searches

Use saved searches to filter your results more quickly

Sign up

Appearance settings

Commit d2c349b

bpo-40559: Add Py_DECREF to _asynciomodule.c:task_step_impl() (GH-19990)

This fixes a possible memory leak in the C implementation of asyncio.Task.

File tree

2 files changed

lines changed

2 files changed

lines changed

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1 +Fix possible memory leak in the C implementation of :class:`asyncio.Task`.
Original file line number Diff line number Diff line change
@@ -2638,6 +2638,10 @@ task_step_impl(TaskObj *task, PyObject *exc)
2638 2638 coro = task->task_coro;
2639 2639 if (coro == NULL) {
2640 2640 PyErr_SetString(PyExc_RuntimeError, "uninitialized Task object");
2641 +if (clear_exc) {
2642 +/* We created 'exc' during this call */
2643 +Py_DECREF(exc);
2644 + }
2641 2645 return NULL;
2642 2646 }
2643 2647