This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author erlendaasland
Recipients M-Reimer, bsteffensmeier, corona10, eric.snow, erlendaasland, graysky, hroncok, ndjensen, petr.viktorin, shihai1991, uckelman, vstinner
Date 2022-01-05.18:52:08
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1641408729.08.0.713288863222.issue46070@roundup.psfhosted.org>
In-reply-to
Content
In 13915a3100608f011b29da2f3716c990f523b631, the init flag is set before we even know if module initialisation was successful. Applying the following patch upon the aforementioned commit (in 3.8) fixes the issue for me on latest Debian:

```
diff --git a/Modules/_asynciomodule.c b/Modules/_asynciomodule.c
index 5261ed3d4c..782138e4e4 100644
--- a/Modules/_asynciomodule.c
+++ b/Modules/_asynciomodule.c
@@ -3250,17 +3250,14 @@ static int
 module_init(void)
 {
     PyObject *module = NULL;
+    if (module_initialized) {
+        return 0;
+    }
 
     asyncio_mod = PyImport_ImportModule("asyncio");
     if (asyncio_mod == NULL) {
         goto fail;
     }
-    if (module_initialized != 0) {
-        return 0;
-    } 
-    else {
-        module_initialized = 1;
-    }
 
     current_tasks = PyDict_New();
     if (current_tasks == NULL) {
@@ -3322,6 +3319,7 @@ module_init(void)
     }
 
     Py_DECREF(module);
+    module_initialized = 1;
     return 0;
 
 fail:
```
History
Date User Action Args
2022-01-05 18:52:09erlendaaslandsetrecipients: + erlendaasland, vstinner, petr.viktorin, eric.snow, ndjensen, hroncok, uckelman, corona10, shihai1991, graysky, bsteffensmeier, M-Reimer
2022-01-05 18:52:09erlendaaslandsetmessageid: <1641408729.08.0.713288863222.issue46070@roundup.psfhosted.org>
2022-01-05 18:52:09erlendaaslandlinkissue46070 messages
2022-01-05 18:52:08erlendaaslandcreate