[PyQt] Pylint and PyQt4 Bus Errors
Derek Harland
derek at chocolate-fish.com
Wed Jul 29 22:53:49 BST 2009
* Great, thanks very much Phil
* On another issue, pylint identifies instances of QtCore.pyqtSignal
(eg QtGui.QPushButton.clicked) as methoddescriptors. The current
unpatched release of logilab.astng (which pylint uses) hopes such
objects also expose __name__
* Of course they don't have to, but I notice the constructor of
pyqtSignal indicates they do have an internal name ... is there any
value to this being exposed as __name__ by PyQt4?
(In any case, logilab.astng is being patched to no longer demand a
__name__)
Derek.
On 30/07/2009, at 9:27 AM, Phil Thompson wrote:
> 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