[Python-Dev] Preventing 1.5 extensions crashing under 1.6/2.0 Python

Mark Hammond mhammond@skippinet.com.au
Mon, 17 Jul 2000 22:16:51 -0400


[Fredrik]
> I'm probably missing something here, but is there any reason
> you cannot add this code to Py_InitModule4 instead:
>
>    PyObject *m, *d, *v;
>    PyMethodDef *ml;
> + if (!Py_IsInitialized())
> +    Py_FatalError("Bad Python version"); /* Never returns */

Py_InitModule4() is inside Pythonxx.dll - so it _will_ be initialized.  The
point of putting this code inside the .pyd is that the .pyd will be calling
the Py_IsInitialized() from Python15.dll - and this DLL has never been
initialized.  Putting it inside Py_InitModule4() will never trigger an
error...

Mark.