Skip to content

Commit da3ce95

Browse files
Drop _PyImport_GetModuleDict().
1 parent 1166c57 commit da3ce95

File tree

2 files changed

+5
-10
lines changed

2 files changed

+5
-10
lines changed

Include/import.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ PyAPI_FUNC(PyObject *) PyImport_ExecCodeModuleObject(
3939
#endif
4040
PyAPI_FUNC(PyObject *) PyImport_GetModuleDict(void);
4141
#ifndef Py_LIMITED_API
42-
PyAPI_FUNC(PyObject *) _PyImport_GetModuleDict(PyInterpreterState *);
4342
PyAPI_FUNC(void) _PyImport_EnsureInitialized(PyInterpreterState *);
4443
#endif
4544
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000

Python/import.c

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -288,30 +288,26 @@ _PyImport_Fini(void)
288288
/* Helper for sys */
289289

290290
PyObject *
291-
_PyImport_GetModuleDict(PyInterpreterState *interp)
291+
PyImport_GetModuleDict(void)
292292
{
293+
PyInterpreterState *interp = PyThreadState_GET()->interp;
293294
if (interp->modules == NULL)
294295
Py_FatalError("PyImport_GetModuleDict: no module dictionary!");
295296
return interp->modules;
296297

297298
/* We aren't ready to do this yet.
298-
if (interp->sysdict == NULL)
299+
PyObject *sysdict = PyThreadState_GET()->interp->sysdict;
300+
if (sysdict == NULL)
299301
Py_FatalError("PyImport_GetModuleDict: no sys module!");
300302
301303
_Py_IDENTIFIER(modules);
302-
PyObject *modules = _PyDict_GetItemId(interp->sysdict, &PyId_modules);
304+
PyObject *modules = _PyDict_GetItemId(sysdict, &PyId_modules);
303305
if (modules == NULL)
304306
Py_FatalError("lost sys.modules");
305307
return modules;
306308
*/
307309
}
308310

309-
PyObject *
310-
PyImport_GetModuleDict(void)
311-
{
312-
return _PyImport_GetModuleDict(PyThreadState_GET()->interp);
313-
}
314-
315311
/* In some corner cases it is important to be sure that the import
316312
machinery has been initialized (or not cleaned up yet). For
317313
example, see issue #4236 and PyModule_Create2(). */

0 commit comments

Comments
 (0)