summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorR. David Murray <rdmurray@bitdance.com>2010-12-15 01:36:03 (GMT)
committerR. David Murray <rdmurray@bitdance.com>2010-12-15 01:36:03 (GMT)
commit64a1e7cab1fe8f0b0b42b93bbd40e73fc983c138 (patch)
tree26ea48b3229827183f286e8121d45e51ec627be0 /Python
parent66ea7c32d21a5c8616a9fb79bfbe100af9bcb6a6 (diff)
downloadcpython-64a1e7cab1fe8f0b0b42b93bbd40e73fc983c138.zip
cpython-64a1e7cab1fe8f0b0b42b93bbd40e73fc983c138.tar.gz
cpython-64a1e7cab1fe8f0b0b42b93bbd40e73fc983c138.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 'Python')
-rw-r--r--Python/modsupport.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/Python/modsupport.c b/Python/modsupport.c
index 6ee48f3..8bdec8b 100644
--- a/Python/modsupport.c
+++ b/Python/modsupport.c
@@ -34,8 +34,9 @@ Py_InitModule4(const char *name, PyMethodDef *methods, const char *doc,
{
PyObject *m, *d, *v, *n;
PyMethodDef *ml;
- 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 (module_api_version != PYTHON_API_VERSION) {
char message[512];
PyOS_snprintf(message, sizeof(message),