8000 bpo-36356: Fix memory leak in _asynciomodule.c (GH-16598) · python/cpython@13915a3 · GitHub
[go: up one dir, main page]

Skip to content

Commit 13915a3

Browse files
bpo-36356: Fix memory leak in _asynciomodule.c (GH-16598)
(cherry picked from commit 321def8) Co-authored-by: Ben Harper <btharper1221@gmail.com>
1 parent 985ec98 commit 13915a3

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Modules/_asynciomodule.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ static PyObject *asyncio_task_repr_info_func;
3333
static PyObject *asyncio_InvalidStateError;
3434
static PyObject *asyncio_CancelledError;
3535
static PyObject *context_kwname;
36+
static int module_initialized;
3637

3738
static PyObject *cached_running_holder;
3839
static volatile uint64_t cached_running_holder_tsid;
@@ -3254,6 +3255,12 @@ module_init(void)
32543255
if (asyncio_mod == NULL) {
32553256
goto fail;
32563257
}
3258+
if (module_initialized != 0) {
3259+
return 0;
3260+
}
3261+
else {
3262+
module_initialized = 1;
3263+
}
32573264

32583265
current_tasks = PyDict_New();
32593266
if (current_tasks == NULL) {

0 commit comments

Comments
 (0)
0