8000 bpo-40559: Add Py_DECREF to _asynciomodule.c:task_step_impl() (GH-19990) · python/cpython@d2c349b · GitHub
[go: up one dir, main page]

Skip to content

Commit d2c349b

Browse files
authored
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.
1 parent 02fa0ea commit d2c349b

File tree

< 8000 div class="d-md-none">

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix possible memory leak in the C implementation of :class:`asyncio.Task`.

< 877E a class="Link--primary prc-Link-Link-85e08" href="#diff-6bd9e39980b88a721d902bcd915bbb3f24762f7f253430c45e52c42a2c5afd01">Modules/_asynciomodule.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2638,6 +2638,10 @@ task_step_impl(TaskObj *task, PyObject *exc)
26382638
coro = task->task_coro;
26392639
if (coro == NULL) {
26402640
PyErr_SetString(PyExc_RuntimeError, "uninitialized Task object");
2641+
if (clear_exc) {
2642+
/* We created 'exc' during this call */
2643+
Py_DECREF(exc);
2644+
}
26412645
return NULL;
26422646
}
26432647

0 commit comments

Comments
 (0)
0