[PyKDE] problem with exceptions within events

Phil Thompson phil at riverbankcomputing.co.uk
Fri Feb 25 23:02:50 GMT 2005

On Friday 25 February 2005 3:33 pm, Ulrich Berning wrote:
> Phil Thompson schrieb:
> >>PyQt or any other extension wrapped with SIP could install an optional
> >>exception handler hook, that is called by SIP, indicating how to handle
> >>the exception (propagate to caller or use PyErr_Print()).
> >
> >It's PyErr_Print() that calls the hook, not the other way around. That
> >hook would have to be installed *after* any application installed hook.
> >Very messy.
> Sorry, I wasn't clear enough. I do not mean 'sys.excepthook' or any
> replacement. I mean a function implemented in PyQt called by SIP.
> SIP calls a method
> SIP checks if an exception has occured
> SIP checks, if the wrapped extension has installed a hook function (The
> module that provides exec_loop would do this)
> If not, SIP calls PyErr_Print() ==> End
> Otherwise SIP calls the hook funtion
> SIP either propagates the exception or calls PyErr_Print() depending on
> the return value of the hook function ==> End
> The hook function has to check, if one of the calling frames of the
> traceback frame contains the method exec_loop.
> Maybe I'm totally wrong with my idea.

I can think of a way to make this work - but it's too much of a change for 
a .1 release. I'll restore the old behaviour for the next snapshot (you'll 
have to re-build PyQt) and add it to the list of things for SIP v4.3.


More information about the PyQt mailing list