summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2019-10-07 09:38:00 -0700
committerGitHub <noreply@github.com>2019-10-07 09:38:00 -0700
commit13915a3100608f011b29da2f3716c990f523b631 (patch)
tree7848643231a171aa3cd767b5c7bb8b98f6ef902c
parent985ec986e864b670687b900a4d6ca977b4e9694d (diff)
downloadcpython-git-13915a3100608f011b29da2f3716c990f523b631.tar.gz
bpo-36356: Fix memory leak in _asynciomodule.c (GH-16598)
(cherry picked from commit 321def805abc5b7c92c7e90ca90cb2434fdab855) Co-authored-by: Ben Harper <btharper1221@gmail.com>
-rw-r--r--Modules/_asynciomodule.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/Modules/_asynciomodule.c b/Modules/_asynciomodule.c
index 8eb480fb77..5261ed3d4c 100644
--- a/Modules/_asynciomodule.c
+++ b/Modules/_asynciomodule.c
@@ -33,6 +33,7 @@ static PyObject *asyncio_task_repr_info_func;
static PyObject *asyncio_InvalidStateError;
static PyObject *asyncio_CancelledError;
static PyObject *context_kwname;
+static int module_initialized;
static PyObject *cached_running_holder;
static volatile uint64_t cached_running_holder_tsid;
@@ -3254,6 +3255,12 @@ module_init(void)
if (asyncio_mod == NULL) {
goto fail;
}
+ if (module_initialized != 0) {
+ return 0;
+ }
+ else {
+ module_initialized = 1;
+ }
current_tasks = PyDict_New();
if (current_tasks == NULL) {