[PyKDE] Exceptions

Phil Thompson phil at river-bank.demon.co.uk
Thu Apr 6 23:11:03 BST 2000

Pete Ware wrote:
> So they're never making it passed the Qt event loop?  So, do things
> look like:
>         eval ()                                 Python interpreter
>                 app.exec_loop()                 Python/sip code
***               savedThreadState = PyEval_SaveThread()
>                         get event               C++ code
>                         dispatch event          C++ code
***                               PyEval_RestoreThread(savedThreadState)
>                                 eval ()         Python interpreter
>                                         x()     Pyhon code
***                               savedThreadState = PyEval_SaveThread()
> So exceptions never make it passed the last eval()?  How do python
> threads get run if there are no qt event's (I haven't actually used
> them so I don't even know if they work)?
> I tried looking at the code (qt/sipqtQApplication.cpp) but I couldn't
> follow it (too much sip stuff I don't know).

I've added extra lines (***) to the above to show how the Python global
interpreter lock is handled.  Basically the lock is released (and other
threads allowed to run) while Qt is processing events.

If you look at the .sip files (particularly qapplication.sip) you'll see
that any function that can cause events to be dispatched has the
ReleaseLock flag specified.  That flag causes the the above extra code
to be generated.

What exactly do you want to see happen?


More information about the PyQt mailing list