Commit 321def80 authored by Ben Harper's avatar Ben Harper Committed by Yury Selivanov

bpo-36356: Fix memory leak in _asynciomodule.c (GH-16598)

parent 303475e8
...@@ -33,6 +33,7 @@ static PyObject *asyncio_task_repr_info_func; ...@@ -33,6 +33,7 @@ static PyObject *asyncio_task_repr_info_func;
static PyObject *asyncio_InvalidStateError; static PyObject *asyncio_InvalidStateError;
static PyObject *asyncio_CancelledError; static PyObject *asyncio_CancelledError;
static PyObject *context_kwname; static PyObject *context_kwname;
static int module_initialized;
static PyObject *cached_running_holder; static PyObject *cached_running_holder;
static volatile uint64_t cached_running_holder_tsid; static volatile uint64_t cached_running_holder_tsid;
...@@ -3247,6 +3248,12 @@ module_init(void) ...@@ -3247,6 +3248,12 @@ module_init(void)
if (asyncio_mod == NULL) { if (asyncio_mod == NULL) {
goto fail; goto fail;
} }
if (module_initialized != 0) {
return 0;
}
else {
module_initialized = 1;
}
current_tasks = PyDict_New(); current_tasks = PyDict_New();
if (current_tasks == NULL) { if (current_tasks == NULL) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment