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.
This commit is contained in:
parent
02fa0ea9c1
commit
d2c349b190
|
@ -0,0 +1 @@
|
||||||
|
Fix possible memory leak in the C implementation of :class:`asyncio.Task`.
|
|
@ -2638,6 +2638,10 @@ task_step_impl(TaskObj *task, PyObject *exc)
|
||||||
coro = task->task_coro;
|
coro = task->task_coro;
|
||||||
if (coro == NULL) {
|
if (coro == NULL) {
|
||||||
PyErr_SetString(PyExc_RuntimeError, "uninitialized Task object");
|
PyErr_SetString(PyExc_RuntimeError, "uninitialized Task object");
|
||||||
|
if (clear_exc) {
|
||||||
|
/* We created 'exc' during this call */
|
||||||
|
Py_DECREF(exc);
|
||||||
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue