[PyQt] Segfault on exceptions in QNetworkAccessManager::createRequest
Phil Thompson
phil at riverbankcomputing.com
Fri Sep 26 13:56:03 BST 2014
On 26/09/2014 1:06 pm, Florian Bruhin wrote:
> * Kovid Goyal <kovid at kovidgoyal.net> [2014-09-26 11:01:20 +0530]:
>> On Fri, Sep 26, 2014 at 06:55:43AM +0200, Florian Bruhin wrote:
>> > Why a print?
>> >
>> > Why not just *raise the exception* so the configured exception handler
>> > gets invoked (for me that is a crash dialog where the user can report
>> > the crash and restart, with their data emergency-saved).
>>
>> Because most projects dont have a native exception handler. And note
>> that this cannot be a python exception, since control at the end of
>> the
>> function returns to native code, not the python VM.
>>
>> The correct solution is for application developers to add exception
>> handling in their implementation in python. The discussion here is
>> about
>> the best way to prompt them to do that.
>>
>> IMO a segfault is hostile and harder to debug. A print and return
>> False
>> or qFatal() is much easier than a segfault.
>
> Hmm, true. In my application I have a 500ms QTimer which gives control
> to the python VM briefly so exceptions are handled.
>
> Though that makes me wonder if there is a way for PyQt to call qFatal
> on Python exceptions if the user doesn't handle exceptions any other
> way, so by default exceptions would terminate the application?
It would be trivial to implement by providing code with
%VirtualErrorHandler.
Phil
More information about the PyQt
mailing list