[PyQt] Old SIP bug reemerging?

Mikael Schönenberg micke at openend.se
Wed May 23 13:47:46 BST 2007


Way back in late 2004 Fredrik, a colleague of mine, reported a
problem[1] that eventually turned out to be a bug[2] in SIP 4.1.1,
which we were using at the time. Phil, as always, resolved the issue
more or less immediately after the source of the error had been
located.

However, after recently upgrading to SIP 4.6 we started to experience
problems that look very similar to the ones we had back then, so I
decided to dig up Fredrik's old test application[3] and run it on our
current environment (Python 2.5, Qt 3.3.4, PyQt 3.17.1, SIP 4.6). As
expected, it indicates that the bug has come back - or that a new
and similar one is there instead.

The problem in itself is that SIP/PyQt sometimes gets confused about
what class an object has. The symptom in the test scripts is that
widgets we know are QLabels are considered by SIP/PyQt to be QWidgets,
and thus QLabel specific attributes will not be present.

I am supplying a slightly modified version of Fredrik's original test
application with this mail. The modifications consist of:
- A couple of print statements that tells you what versions of Qt,
  PyQt and SIP you're running.
- A minor patch to an iteration needed since QWidget.children()
  nowadays return None rather than an empty list if a widget has no
  children.

The application creates a large number of labels, and gives you a
button to press to destroy and recreate all of them. Given sufficient
amount of clicks on the button, the bug will (probably) be
provoked. An Auto-redraw check box can be ticked to have the
application simulate a button click once every hundred
milliseconds. Tick it, wait sufficiently long (generally less than a
minute for me) and see the tracebacks start spamming...

It should be pointed out that I don't really have anything indicating
that the problem we're experiencing now is in any way related to the
one reported back in 2004. However, as the symptoms are similar and
the same test case can be used to demonstrate the problem, I thought
it might be worth mentioning the previous discussion about it.

I must admit that I have not been paying very close attention to this
list lately, so if this problem has been reported recently, I
apologise for wasting your time.

[1] http://www.riverbankcomputing.com/pipermail/pyqt/2004-November/009008.html
[2] http://www.riverbankcomputing.com/pipermail/pyqt/2004-November/009070.html
[3] http://www.riverbankcomputing.com/pipermail/pyqt/2004-November/009021.html

-- 
Mikael Schönenberg <micke at openend.se>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sip-4.6_bug.tar.gz
Type: application/octet-stream
Size: 2816 bytes
Desc: not available
Url : http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20070523/e9239b6d/sip-4.6_bug.tar.obj


More information about the PyQt mailing list