mirror of
https://github.com/python/cpython
synced 2026-09-29 11:30:29 +03:00
bpo-28411: Remove "modules" field from Py_InterpreterState. (#1638)
sys.modules is the one true source.
This commit is contained in:
parent
f5ea83f486
commit
86b7afdfee
18 changed files with 261 additions and 111 deletions
|
|
@ -160,12 +160,18 @@ _add_methods_to_object(PyObject *module, PyObject *name, PyMethodDef *functions)
|
|||
|
||||
PyObject *
|
||||
PyModule_Create2(struct PyModuleDef* module, int module_api_version)
|
||||
{
|
||||
if (!_PyImport_IsInitialized(PyThreadState_GET()->interp))
|
||||
Py_FatalError("Python import machinery not initialized");
|
||||
return _PyModule_CreateInitialized(module, module_api_version);
|
||||
}
|
||||
|
||||
PyObject *
|
||||
_PyModule_CreateInitialized(struct PyModuleDef* module, int module_api_version)
|
||||
{
|
||||
const char* name;
|
||||
PyModuleObject *m;
|
||||
PyInterpreterState *interp = PyThreadState_Get()->interp;
|
||||
if (interp->modules == NULL)
|
||||
Py_FatalError("Python import machinery not initialized");
|
||||
|
||||
if (!PyModuleDef_Init(module))
|
||||
return NULL;
|
||||
name = module->m_name;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue