File tree Expand file tree Collapse file tree 2 files changed +5
-10
lines changed Expand file tree Collapse file tree 2 files changed +5
-10
lines changed Original file line number Diff line number Diff line change @@ -39,7 +39,6 @@ PyAPI_FUNC(PyObject *) PyImport_ExecCodeModuleObject(
39
39
#endif
40
40
PyAPI_FUNC (PyObject * ) PyImport_GetModuleDict (void );
41
41
#ifndef Py_LIMITED_API
42
- PyAPI_FUNC (PyObject * ) _PyImport_GetModuleDict (PyInterpreterState * );
43
42
PyAPI_FUNC (void ) _PyImport_EnsureInitialized (PyInterpreterState * );
44
43
#endif
45
44
#if !defined(Py_LIMITED_API ) || Py_LIMITED_API + 0 >= 0x03030000
Original file line number Diff line number Diff line change @@ -288,30 +288,26 @@ _PyImport_Fini(void)
288
288
/* Helper for sys */
289
289
290
290
PyObject *
291
- _PyImport_GetModuleDict ( PyInterpreterState * interp )
291
+ PyImport_GetModuleDict ( void )
292
292
{
293
+ PyInterpreterState * interp = PyThreadState_GET ()-> interp ;
293
294
if (interp -> modules == NULL )
294
295
Py_FatalError ("PyImport_GetModuleDict: no module dictionary!" );
295
296
return interp -> modules ;
296
297
297
298
/* We aren't ready to do this yet.
298
- if (interp->sysdict == NULL)
299
+ PyObject *sysdict = PyThreadState_GET()->interp->sysdict;
300
+ if (sysdict == NULL)
299
301
Py_FatalError("PyImport_GetModuleDict: no sys module!");
300
302
301
303
_Py_IDENTIFIER(modules);
302
- PyObject *modules = _PyDict_GetItemId(interp-> sysdict, &PyId_modules);
304
+ PyObject *modules = _PyDict_GetItemId(sysdict, &PyId_modules);
303
305
if (modules == NULL)
304
306
Py_FatalError("lost sys.modules");
305
307
return modules;
306
308
*/
307
309
}
308
310
309
- PyObject *
310
- PyImport_GetModuleDict (void )
311
- {
312
- return _PyImport_GetModuleDict (PyThreadState_GET ()-> interp );
313
- }
314
-
315
311
/* In some corner cases it is important to be sure that the import
316
312
machinery has been initialized (or not cleaned up yet). For
317
313
example, see issue #4236 and PyModule_Create2(). */
You can’t perform that action at this time.
0 commit comments