[PyKDE] problem with exceptions within events

Phil Thompson phil at riverbankcomputing.co.uk
Fri Feb 25 14:48:57 GMT 2005


> Phil Thompson schrieb:
>
>>>Why not inspect the calling frames? A method called asynchronous by
>>>QApplication.exec_loop() must have exec_loop() in one of it's outer
>>>frames, a method called synchronous outside the exec_loop doesn't have
>>>exec_loop() in its outer frames. It's just an idea, don't know if it
>>>could work.
>>>
>>>
>>
>>My first reaction is that it is very PyQt specific - you'd want to have
>> an
>>annotation that allowed to you to mark a method as needing that sort of
>>treatment. I haven't done much with inspecting Python byte code, but the
>>phrase "can of worms" springs to mind.
>>
>>
>>
> What do you mean with 'very PyQt specific'?
> Do you mean the fact, that SIP has to do the error checking after a
> method call, not knowing if it has called a method from a PyQt class or
> from any other class that is wrapped with SIP?

I mean that you are looking for a specific PyQt name. The annotation would
get around that so that it would just look for a flag.

> 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.

Phil




More information about the PyQt mailing list