mirror of
https://github.com/python/cpython.git
synced 2025-07-29 06:05:00 +00:00
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. ........
This commit is contained in:
parent
66ea7c32d2
commit
64a1e7cab1
3 changed files with 20 additions and 3 deletions
|
@ -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),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue