[mod_python] PyThreadState_Swap(NULL)

Bryan belred at gmail.com
Sat Aug 19 13:02:31 EDT 2006


hi,


i've written a program that uses python c api code that lives in a shared 
library that is loaded by a custom apache module (mod_xxx).  this python c api 
code all works correctly under our test server and under apache but only if 
mod_python isn't loaded.  when apache loads mod_python as shown in the http.conf 
snippet below, PyThreadState_Swap(NULL) in mod_xxx returns NULL.  when the 
snippet of code in http.conf is commented out, it works again.  what do i have 
to do to have mod_xxx code work correctly when apache loads mod_python?

i put our module after mod_python, commented out Py_Initialize(), and 
Py_IsInitialized() returned True, but PyThreadState_Swap() failed.

i put our module before mod_python, called Py_Initialize(), and 
Py_IsInitialized() returned True, but PyThreadState_Swap() failed.

i removed mod_python and our module succeeded.

i even tested combinations of calling and PyEval_InitThreads() but didn't work 
either.


any help to get our custom module co-existing with mod_python would be very 
appreciated.

thanks,

bryan



More information about the Mod_python mailing list