diff options
author | Nico-Posada <102486290+Nico-Posada@users.noreply.github.com> | 2024-10-31 07:47:57 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-31 07:47:57 (GMT) |
commit | d07dcce6935364cab807e0df931ed09b088ade69 (patch) | |
tree | 34ad1a05566414287caa39f40c30b11b1ac5e7f7 /Modules | |
parent | d467d9246cbe0ce5dc149c4c74223bb8374ece73 (diff) | |
download | cpython-d07dcce6935364cab807e0df931ed09b088ade69.zip cpython-d07dcce6935364cab807e0df931ed09b088ade69.tar.gz cpython-d07dcce6935364cab807e0df931ed09b088ade69.tar.bz2 |
gh-126083: Fix a reference leak in `asyncio.Task` when reinitializing with new non-`None` context (#126103)
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_asynciomodule.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Modules/_asynciomodule.c b/Modules/_asynciomodule.c index d4135f0..c2500fb 100644 --- a/Modules/_asynciomodule.c +++ b/Modules/_asynciomodule.c @@ -2120,7 +2120,7 @@ _asyncio_Task___init___impl(TaskObj *self, PyObject *coro, PyObject *loop, return -1; } } else { - self->task_context = Py_NewRef(context); + Py_XSETREF(self->task_context, Py_NewRef(context)); } Py_CLEAR(self->task_fut_waiter); |