Skip to content

Commit

Permalink
bpo-40559: Add Py_DECREF to _asynciomodule.c:task_step_impl() (python…
Browse files Browse the repository at this point in the history
…GH-19990)

This fixes a possible memory leak in the C implementation of
asyncio.Task.
  • Loading branch information
cjerdonek authored May 8, 2020
1 parent 02fa0ea commit d2c349b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix possible memory leak in the C implementation of :class:`asyncio.Task`.
4 changes: 4 additions & 0 deletions Modules/_asynciomodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -2638,6 +2638,10 @@ task_step_impl(TaskObj *task, PyObject *exc)
coro = task->task_coro;
if (coro == NULL) {
PyErr_SetString(PyExc_RuntimeError, "uninitialized Task object");
if (clear_exc) {
/* We created 'exc' during this call */
Py_DECREF(exc);
}
return NULL;
}

Expand Down

0 comments on commit d2c349b

Please sign in to comment.