summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorNico-Posada <102486290+Nico-Posada@users.noreply.github.com>2024-10-31 07:47:57 (GMT)
committerGitHub <noreply@github.com>2024-10-31 07:47:57 (GMT)
commitd07dcce6935364cab807e0df931ed09b088ade69 (patch)
tree34ad1a05566414287caa39f40c30b11b1ac5e7f7 /Modules
parentd467d9246cbe0ce5dc149c4c74223bb8374ece73 (diff)
downloadcpython-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.c2
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);