[PyQt] Segfault on exceptions in QNetworkAccessManager::createRequest

Phil Thompson phil at riverbankcomputing.com
Fri Sep 26 12:57:56 BST 2014


On 26/09/2014 12:45 pm, Kovid Goyal wrote:
> On Fri, Sep 26, 2014 at 09:45:32AM +0100, Phil Thompson wrote:
>> 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.
> 
> Since you know that Qt is going to segfault, when you return NULL, 
> instead of
> returning NULL, call qFatal().

Understood - I'll think about that one.

> Or print and return None.

That's the current behaviour - returning None triggers the segfault.

> Either approach
> is better than just leaving it up to users of PyQt to debug a
> segfault in their applications.

Phil


More information about the PyQt mailing list