[PyQt] Segfault on exceptions in QNetworkAccessManager::createRequest

Phil Thompson phil at riverbankcomputing.com
Thu Sep 25 23:32:47 BST 2014

On 25/09/2014 6:34 pm, Kovid Goyal wrote:
> On Thu, Sep 25, 2014 at 04:57:14PM +0100, Phil Thompson wrote:
>> The value returned depends on the C++ return type. In this case, where 
>> a
>> pointer is expected, the value is NULL.
>> The way to handle this might be to add a new annotation /NotNone/ that 
>> says
>> that NULL should not be returned to C++, or another annotation might 
>> specify
>> the default value that is returned when an exception is raised. 
>> However in
>> either case you won't be telling C++ that there is a problem and it 
>> will
>> carry on regardless - maybe a crash is the best thing to do in this
>> circumstance.
> I'd say print "unhandled exception in method so-and-so" and continue
> ignoring the exception. Debugging C++ level crashes is a PITA for most
> python developers.

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.


More information about the PyQt mailing list