File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ Fix possible segfault when importing the :mod: `asyncio ` module from
2+ different sub-interpreters in parallel. Patch by Erlend E. Aasland.
Original file line number Diff line number Diff line change @@ -3318,17 +3318,14 @@ static int
33183318module_init (void )
33193319{
33203320 PyObject * module = NULL ;
3321+ if (module_initialized ) {
3322+ return 0 ;
3323+ }
33213324
33223325 asyncio_mod = PyImport_ImportModule ("asyncio" );
33233326 if (asyncio_mod == NULL ) {
33243327 goto fail ;
33253328 }
3326- if (module_initialized != 0 ) {
3327- return 0 ;
3328- }
3329- else {
3330- module_initialized = 1 ;
3331- }
33323329
33333330 current_tasks = PyDict_New ();
33343331 if (current_tasks == NULL ) {
@@ -3389,6 +3386,7 @@ module_init(void)
33893386 goto fail ;
33903387 }
33913388
3389+ module_initialized = 1 ;
33923390 Py_DECREF (module );
33933391 return 0 ;
33943392
You can’t perform that action at this time.
0 commit comments