Kirill Simonov wrote: > Hi, > > Could someone tell me why my extension module works under Python 2.4, but > fails with Segmentation Fault under Python 2.3? Here is the stripped version:
Maybe Python threads aren't initialized? Adding a call to PyEval_InitThreads() stops the seg fault for me in Python 2.3 on Debian: #include <Python.h> static PyObject * test_gil(PyObject *self) { PyGILState_STATE gs; Py_BEGIN_ALLOW_THREADS gs = PyGILState_Ensure(); PyGILState_Release(gs); Py_END_ALLOW_THREADS Py_INCREF(Py_None); return Py_None; } static PyMethodDef test_gil_methods[] = { {"test_gil", (PyCFunction)test_gil, METH_NOARGS}, {NULL} }; PyMODINIT_FUNC init_test_gil(void) { /* This added */ PyEval_InitThreads(); (void)Py_InitModule("_test_gil", test_gil_methods); } -- http://mail.python.org/mailman/listinfo/python-list