PyThreadState_Swap difference in 2.3.2?

Paul Miller paul at fxtech.com
Mon Dec 15 17:05:40 EST 2003


I have a C++ application that uses multiple embedded Python interpreters. I
allocate multiple interpreters using Py_NewInterpreter, and switch between
them using PyThreadSate_Swap.

In 2.2.2, this all worked fine.

I just installed 2.3.2, but now the first time I call Py_NewInterpreter, it
bails out in PyThreadState_Swap, in the debug checking code, with:

	Py_FatalError("Invalid thread state for this thread");

Has the interpreter/thread setup code changed since 2.2? 

To be complete, I set up with this:

	Py_Initialize();
	PyThreadState *globalState = PyThreadState_Get();

	// allocate new interpreter
	PyThreadState *interp = Py_NewInterpreter();

I am investigating to see if a crash I used to see with 2.2 is still around
in 2.3, where if you call Py_Initialize() and Py_Finalize() multiple times
it would die.






More information about the Python-list mailing list