[PyQt] Exception within Slot causes Abort
Phil Thompson
phil at riverbankcomputing.com
Sun Mar 20 10:32:44 GMT 2016
On 20/03/2016 10:17 am, Dave Gradwell wrote:
> In PyQt 5.5.1, raising an Exception within a Slot results in qFatal()
> calling Abort.
> That behaviour seems to be documented here, so in a way it seems hard
> to argue with:
> http://doc.qt.io/qt-5/exceptionsafety.html#signals-and-slots
> """Throwing an exception from a slot invoked by Qt's signal-slot
> connection mechanism is considered undefined behaviour, unless it is
> handled within the slot"""
That's referring to C++ exceptions, not Python exceptions.
> But it worked nicely in 5.4.1 so it seems like a pity.
An unhandled Python exception is an error.
> Is there any way of allowing Python Exceptions to be raised within PyQt
> slots?
> If not, what is the recommended way of achieving something similar?
You should be able to use the usual hooks.
Phil
More information about the PyQt
mailing list