A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2006-January/059716.html below:

[Python-Dev] pystate.c changes for Python 2.4.2

[Python-Dev] pystate.c changes for Python 2.4.2 [Python-Dev] pystate.c changes for Python 2.4.2Gabriel Becedillas gabriel.becedillas at corest.com
Thu Jan 12 17:47:31 CET 2006
Hi,
At the company I work for, we've embedded Python in C++ application we 
develop. Since our upgrade to Python 2.4.2 from 2.4.1 we started hitting 
Py_FatalError("Invalid thread state for this thread") when using debug 
builds.
We use both multiple interpreters and thread states.

I think the problem is that PyThreadState_Delete (which is used when I
destroy thread states and interpreters) is not making the same clean up
that PyThreadState_DeleteCurrent is doing (which is used when we create 
threads from python code). If a thread id is reused (obviously not 
between two running threads), and the previous thread used 
PyThreadState_Delete instead of PyThreadState_DeleteCurrent, then an old 
and invalid value for autoTLSkey is still stored, and that is
triggering the Py_FatalError when a call to PyThreadState_Swap is made.
If I add this code at the end of PyThreadState_Delete:

if (autoTLSkey && PyThread_get_key_value(autoTLSkey) == tstate)
	PyThread_delete_key_value(autoTLSkey);

then everything works fine.
Could you please confirm if this is a bug ?
Thanks a lot and have a nice day.
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4