File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -1313,6 +1313,7 @@ import_find_extension(PyThreadState *tstate,
1313
1313
if (def == NULL ) {
1314
1314
return NULL ;
1315
1315
}
1316
+ assert (is_singlephase (def ));
1316
1317
1317
1318
/* It may have been successfully imported previously
1318
1319
in an interpreter that allows legacy modules
@@ -1360,12 +1361,16 @@ import_find_extension(PyThreadState *tstate,
1360
1361
|| _PyModule_GetDef (mod ) == def );
1361
1362
}
1362
1363
else {
1363
- if (def -> m_base .m_init == NULL )
1364
+ if (def -> m_base .m_init == NULL ) {
1364
1365
return NULL ;
1365
- mod = def -> m_base .m_init ();
1366
- if (mod == NULL ) {
1366
+ }
1367
+ struct _Py_ext_module_loader_result res ;
1368
+ if (_PyImport_RunModInitFunc (def -> m_base .m_init , info , & res ) < 0 ) {
1367
1369
return NULL ;
1368
1370
}
1371
+ assert (!PyErr_Occurred ());
1372
+ mod = res .module ;
1373
+ // XXX __file__ doesn't get set!
1369
1374
if (PyObject_SetItem (modules , info -> name , mod ) == -1 ) {
1370
1375
Py_DECREF (mod );
1371
1376
return NULL ;
You can’t perform that action at this time.
0 commit comments