diff options
Diffstat (limited to 'Python/import.c')
-rw-r--r-- | Python/import.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/Python/import.c b/Python/import.c index 8742b6e..a671a08 100644 --- a/Python/import.c +++ b/Python/import.c @@ -153,6 +153,20 @@ _PyImport_GetModules(PyInterpreterState *interp) return MODULES(interp); } +PyObject * +_PyImport_GetModulesRef(PyInterpreterState *interp) +{ + _PyImport_AcquireLock(interp); + PyObject *modules = MODULES(interp); + if (modules == NULL) { + /* The interpreter hasn't been initialized yet. */ + modules = Py_None; + } + Py_INCREF(modules); + _PyImport_ReleaseLock(interp); + return modules; +} + void _PyImport_ClearModules(PyInterpreterState *interp) { |