summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorR. David Murray <rdmurray@bitdance.com>2010-12-14 23:30:42 (GMT)
committerR. David Murray <rdmurray@bitdance.com>2010-12-14 23:30:42 (GMT)
commit800dfee91a081547eaac9eabd5883998a5231324 (patch)
tree0828bb792bd83febc2dc87e61e08eb11978d5f53 /Objects
parent6ed3244557051031c2f3aa1de22080e12b341d1b (diff)
downloadcpython-800dfee91a081547eaac9eabd5883998a5231324.zip
cpython-800dfee91a081547eaac9eabd5883998a5231324.tar.gz
cpython-800dfee91a081547eaac9eabd5883998a5231324.tar.bz2
Merged revisions 87251 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r87251 | r.david.murray | 2010-12-14 18:06:25 -0500 (Tue, 14 Dec 2010) | 4 lines #4236: avoid possible Fatal Error when import is called from __del__ Patch by Simon Cross, crasher test code by Martin von Löwis. ........
Diffstat (limited to 'Objects')
-rw-r--r--Objects/moduleobject.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/Objects/moduleobject.c b/Objects/moduleobject.c
index 5dd9c01..d96d7bd 100644
--- a/Objects/moduleobject.c
+++ b/Objects/moduleobject.c
@@ -67,8 +67,9 @@ PyModule_Create2(struct PyModuleDef* module, int module_api_version)
PyMethodDef *ml;
const char* name;
PyModuleObject *m;
- if (!Py_IsInitialized())
- Py_FatalError("Interpreter not initialized (version mismatch?)");
+ PyInterpreterState *interp = PyThreadState_Get()->interp;
+ if (interp->modules == NULL)
+ Py_FatalError("Python import machinery not initialized");
if (PyType_Ready(&moduledef_type) < 0)
return NULL;
if (module->m_base.m_index == 0) {