Skip to content

Commit 855c4f9

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

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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy