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.
This commit is contained in:
Guido van Rossum 2000-08-04 14:00:14 +00:00
parent b9fa0a843e
commit 413407f103
1 changed files with 2 additions and 0 deletions

View File

@ -47,6 +47,8 @@ Py_InitModule4(char *name, PyMethodDef *methods, char *doc,
{
PyObject *m, *d, *v;
PyMethodDef *ml;
if (!Py_IsInitialized())
Py_FatalError("Interpreter not initialized (version mismatch?)");
if (module_api_version != PYTHON_API_VERSION)
fprintf(stderr, api_version_warning,
name, PYTHON_API_VERSION, name, module_api_version);