[PyQt] Bug with non-QObject signal callbacks

Phil Thompson phil at riverbankcomputing.com
Fri Jul 17 14:00:38 BST 2009


On Thu, 16 Jul 2009 16:08:51 -0500, Robert Kern <robert.kern at gmail.com>
wrote:
> I've tried to connect an instance method as a new-style signal callback.
> This 
> works if I do nothing else, but if I happen to call a numpy method after 
> connecting the callback, I get an error from PyQt, but during the numpy
> call:
> 
> Traceback (most recent call last):
>    File "signal_bug.py", line 30, in <module>
>      main()
>    File "signal_bug.py", line 24, in main
>      nqo = NotQObject(slider)
>    File "signal_bug.py", line 14, in __init__
>      a = numpy.arange(10).max()
> TypeError: NotQObject cannot be converted to PyQt4.QtCore.QObject in this
> context
> 
> 
> There are some places in numpy where we check to see if anyone has set an

> exception. I suspect that what is happening is that PyQt is checking if
the
> 
> "self" on the bound instancemethod callback is a QObject in order to go
> down one 
> path and otherwise go down another and failing to clear up this exception
> before 
> returning control. I am using PyQt4 4.5 on OS X and trunk numpy, but I
> suspect 
> any numpy will do. I am downloading 4.5.2 now to see if this has been
fixed
> in 
> the meantime, but I do not see anything in the changelog that looks
> promising.

Your analysis is correct. Fixed in tonight's snapshot.

Thanks,
Phil


More information about the PyQt mailing list