[PyQt] Segfault on exceptions in QNetworkAccessManager::createRequest

Phil Thompson phil at riverbankcomputing.com
Fri Sep 26 09:45:32 BST 2014


On 26/09/2014 5:01 am, Kovid Goyal wrote:
> On Thu, Sep 25, 2014 at 11:32:47PM +0100, Phil Thompson wrote:
>> I would argue that the alternative of returning an arbitrary 
>> QNetworkReply
>> instance (in this case) is worse because it is a bug that would be 
>> extremely
>> difficult to detect and isolate. At least with a crash you know where 
>> it
>> happened.
> 
> That's what the print is for. If you really want to crash then dont
> segfault, at least use qFatal.

The segfault is in Qt because it is always dereferencing a pointer 
without checking for NULL. The issue is whether PyQt should (in the case 
of a Python exception) return a value that doesn't trigger the segfault 
- but will be "wrong" and possibly cause very difficult to identify 
behaviour later on the in application.

Phil


More information about the PyQt mailing list