File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Expand file tree Collapse file tree 2 files changed +6
-6
lines changed 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
3318
3318
module_init (void )
3319
3319
{
3320
3320
PyObject * module = NULL ;
3321
+ if (module_initialized ) {
3322
+ return 0 ;
3323
+ }
3321
3324
3322
3325
asyncio_mod = PyImport_ImportModule ("asyncio" );
3323
3326
if (asyncio_mod == NULL ) {
3324
3327
goto fail ;
3325
3328
}
3326
- if (module_initialized != 0 ) {
3327
- return 0 ;
3328
- }
3329
- else {
3330
- module_initialized = 1 ;
3331
- }
3332
3329
3333
3330
current_tasks = PyDict_New ();
3334
3331
if (current_tasks == NULL ) {
@@ -3389,6 +3386,7 @@ module_init(void)
3389
3386
goto fail ;
3390
3387
}
3391
3388
3389
+ module_initialized = 1 ;
3392
3390
Py_DECREF (module );
3393
3391
return 0 ;
3394
3392
You can’t perform that action at this time.
0 commit comments