Fatal Python error: PyEval_RestoreThread: NULL tstate

R

reinhard

Our project was developed with Python 2.0 and includes some Tk 8.3
extension widgets as well as python extensions using the CXX interface.

After moving to Python 2.3 and TclTk 8.4 our program hangs with the
following message:

Fatal Python error: PyEval_RestoreThread: NULL tstate

The strange thing is that this happens in a not very predictible way;
some data is loaded and displayed in a self-made Tk widget. This works
fine a couple of times and usually crashes when a widget is closed and a
new one is opend. Debugging the widget code didn't give any hints.

Does anyone know which changes in python (2.0 -> 2.3) or TclTk/tkinter
(8.3 -> 8.4) might be responsible for this? Are there any solutions?


Reinhard Nadrchal
 
W

Warren Postma

Fatal Python error: PyEval_RestoreThread: NULL tstate

This error happened to me when I used Python embedded into a C app as
it's script engine. The thread state is a global variable, pointing to
a thread state object. Something, very literally is causing a change of
Python thread-state. Abuse of the global interpreter lock could cause
this, as could sloppily written code, the most common case is when
something returns (on error condition) and doesn't restore everything to
the way it was supposed to be on exit of the function. I suspect your
CXX extensions may be having some kindo f error or exception, and
something is returning without having properly unlocked or released
something.... Sorry to be so vague.

Warren
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top