summaryrefslogtreecommitdiffstats
path: root/Objects/moduleobject.c
diff options
context:
space:
mode:
authorEric Snow <ericsnowcurrently@gmail.com>2017-09-14 06:46:04 (GMT)
committerGitHub <noreply@github.com>2017-09-14 06:46:04 (GMT)
commit93c92f7d1dbb6e7e472f1d0444c6968858113de2 (patch)
tree031230f9b0cf2e8a8ef21f7fc40c4f5f98d20c6c /Objects/moduleobject.c
parent13ad3b7a82bf56d803fbe48ee5df6c4b08986c78 (diff)
downloadcpython-93c92f7d1dbb6e7e472f1d0444c6968858113de2.zip
cpython-93c92f7d1dbb6e7e472f1d0444c6968858113de2.tar.gz
cpython-93c92f7d1dbb6e7e472f1d0444c6968858113de2.tar.bz2
bpo-31404: Revert "remove modules from Py_InterpreterState (#1638)" (#3565)
PR #1638, for bpo-28411, causes problems in some (very) edge cases. Until that gets sorted out, we're reverting the merge. PR #3506, a fix on top of #1638, is also getting reverted.
Diffstat (limited to 'Objects/moduleobject.c')
-rw-r--r--Objects/moduleobject.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/Objects/moduleobject.c b/Objects/moduleobject.c
index 2be49fb..5fab06d 100644
--- a/Objects/moduleobject.c
+++ b/Objects/moduleobject.c
@@ -162,17 +162,11 @@ _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;