[PyKDE] PyEval_RestoreThread Error

Phil Thompson phil at riverbankcomputing.co.uk
Thu Aug 21 14:58:01 BST 2003


On Thursday 21 August 2003 12:05 pm, Michael Andrews wrote:
> I don't know if this is a Python, Qt, or PyQt issue.  I thought I'd
> start with PyQt and we'll see where it leads.  I am trying to build a
> new Python/Qt environment consisting of:
>   Python 2.3, Qt-3.2.0, sip-3.8, and PyQt-3.8
> When I run the bug_test.py script below and then immediately press the
> Quit button, python dumps core with the following error:
>
>   Fatal Python error: PyEval_RestoreThread: NULL tstate
>
> I have reproduced the problem under HPUX 11 and Redhat Linux-9, and the
> 'application' works fine under Python 2.2.3, Qt 3.1.2, sip-3.6, and
> PyQt-3.6.
>
> The problem appears to be the fact that my UIMainC class (the
> controller) has a member which is the AppClass and the AppClass has a
> member which is the controller.  If I remove the UIMainC.app everything
> works.
>
> Any suggestions on how to proceed?

Because of the circular reference count you've created I suspect that PyQt is 
having trouble arranging for dtors to be called in a sensible order.

IMHO, passing self as a function/method argument from an __init__() method is 
dubious because there is the danger that the instance will be used when it 
hasn't been fully initialised.

Phil




More information about the PyQt mailing list