[issue14615] pull some import state out of the interpreter state

Eric Snow report at bugs.python.org
Wed Apr 18 19:54:17 CEST 2012


Eric Snow <ericsnowcurrently at gmail.com> added the comment:

Curse you, undocumented API that we have to support!  It could still wrap a simple get() on sys.modules, roughly like this:

PyObject*
PyState_FindModule(struct PyModuleDef* m)
{
    PyObject* modules, module;
    modules = PyImport_GetModuleDict();
    if (modules == NULL)
        return NULL;
    module = PyDict_GetItemString(sys_modules, m->m_name);
    return module==Py_None ? NULL : module;
}

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue14615>
_______________________________________


More information about the Python-bugs-list mailing list