[PyQt] Exceptions in Python Implementations of Virtuals

Phil Thompson phil at riverbankcomputing.com
Tue Sep 30 18:24:57 BST 2014

On 30/09/2014 5:52 pm, Chris Colbert wrote:
> I'm strongly -1 on this.
> I think exceptions should be handled consistently throughout the 
> library.

I agree, but they aren't at the moment.

> So if you were to make this change for virtual functions, it should 
> also be
> made for signal handlers.


> But, user code excepting on the path of a signal
> handler or a virtual event method is very common in my experience, and 
> not
> all of these exceptions prohibit the app from continuing to function.

If I get them I consider them a bug in my application.

> Fataling the app, on the other hand, would lead to absolute mayhem on 
> the
> production floor.
> Imagine a case where a finance app developer misspells some attribute 
> like
> palette and has insufficient test coverage. Crashing the app in the 
> middle
> of trade execution is a much worse outcome than failing to color the 
> line
> edit correctly.

Let me paraphrase what you just said...

An application spends my money. It hasn't been tested. If it has bugs I 
don't want to know about them.

> It would be nice to have an easier way than except hooks to be able to
> detect and handle these cases, and I think exploring options in that 
> space
> is worthy of discussion. But I think qFatal is certainly the wrong 
> approach
> here.


More information about the PyQt mailing list