[PyQt] Exceptions in Python Implementations of Virtuals

Phil Thompson phil at riverbankcomputing.com
Tue Sep 30 17:23:08 BST 2014

Florian asked this question but it didn't result in any discussion, so 
I'd like to have another poke at it.

Currently, if an exception is raised by a Python re-implementation of a 
C++ virtual then the exception is printed and the application continues. 
A default result will be constructed by PyQt and returned to C++. 
Instead, should PyQt print the exception and then terminate (by calling 

Some advantages...

- consistency in what happens when an unhandled exception is raised (ie. 
the application always terminates)
- such bugs become obvious and easy to find

Some disadvantages...

- incompatible with current behaviour
- may cause problems with applications that already try to handle such 
exceptions using exception hooks

If I make this change it will be for PyQt5 only. I don't plan to make 
the change configurable in any way.



More information about the PyQt mailing list