[Python-Dev] Preventing 1.5 extensions crashing under 1.6/2.0 Python
Fredrik Lundh
Fredrik Lundh" <effbot@telia.com
Mon, 17 Jul 2000 10:09:53 +0200
mark wrote:
> If we are asking them to change their code, can we investigate whether
> asking them to insert a simple:
>=20
> if (!Py_IsInitialized())
> Py_FatalError("Bad Python version"); /* Never returns */
>=20
> works OK? I believe it will, as long as Python's fatal error handler
> doesnt make thread-state assumptions.
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 */
if (module_api_version !=3D PYTHON_API_VERSION)
fprintf(stderr, api_version_warning,
</F>