Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 413407f

Browse files
committed
Add a test that Py_IsInitialized() in Py_InitModule4(). See
python-dev discussion. This should catch future version incompatibilities on Windows. Alas, this doesn't help for 1.5 vs. 1.6; but it will help for 1.6 vs. 2.0.
1 parent b9fa0a8 commit 413407f

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

Python/modsupport.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ Py_InitModule4(char *name, PyMethodDef *methods, char *doc,
4747
{
4848
PyObject *m, *d, *v;
4949
PyMethodDef *ml;
50+
if (!Py_IsInitialized())
51+
Py_FatalError("Interpreter not initialized (version mismatch?)");
5052
if (module_api_version != PYTHON_API_VERSION)
5153
fprintf(stderr, api_version_warning,
5254
name, PYTHON_API_VERSION, name, module_api_version);

0 commit comments

Comments
 (0)