[PyQt] Pylint and PyQt4 Bus Errors

Phil Thompson phil at riverbankcomputing.com
Wed Jul 29 22:27:15 BST 2009


On Wed, 29 Jul 2009 23:05:52 +1200, Derek Harland
<derek at chocolate-fish.com>
wrote:
> Hi Sylvain (and hopefully some helpful PyQt people!)
> 
> * As noted earlier, after applying my patch to get pylint to recognise  
> PyQt4, pylint will Bus Error depending on import order
> eg
>      from PyQt4 import QtCore, QtGui      # will cause pylint to  
> BusError
>      from PyQt4 import QtGui , QtCore     # pylint is happy ...
> 
> * After a long fight of constant crashes I've debugged down to the  
> statement that actually crashes :-)
> * Its because there is something strange about QtCore.QSignalMapper,  
> and here is the problem replicated ...
> 
>  >>> from PyQt4 import QtCore
>  >>> isinstance(QtCore.QSignalMapper, types.MethodType)
> Bus error
> 
> However this works ...
> 
>  >>> from PyQt4 import QtCore, QtGui
>  >>> isinstance(QtCore.QSignalMapper, types.MethodType)
> False
> 
> pylint sparks a crash (or rather logilab.astng.builder does) as it  
> will attempt to import and fully analyse QtCore before loading QtGui.
> I'm hoping Phil at Riverbank Software might be able to cast some light  
> on what state QSignalMapper might be in before QtGui exists ...
> 
> Kind regards
> Derek
> 
> [Machine details:
>    - OSX10.5 running macports python 2.6.2
>    - PyQt4.5.4, sip 4.8.2
>    - pylint 0.18, logilab.astng 0.19, logilab.common 0.42
> ]

This should be fixed in tonight's SIP snapshot.

The problem is that QSignalMapper has a signal that passes a QWidget which,
of course, isn't defined in QtCore. SIP has mechanisms for dealing with
these sorts of forward references but the code that converts a type as a
string to a generated type object wasn't dealing with it very well.

Thanks,
Phil


More information about the PyQt mailing list