[PyQt] Unable to weakreference pyqtBoundSignal

Phil Thompson phil at riverbankcomputing.com
Fri Sep 29 09:58:23 BST 2017


On 29 Sep 2017, at 4:22 am, Kyle Altendorf <sda at fstab.net> wrote:
> 
> TypeError: cannot create weak reference to 'PyQt5.QtCore.pyqtBoundSignal' object
> 
> Are pyqtBoundSignals intentionally not weak referenceable?  If not, could it be?
> 
> Example and output:
>    https://gist.github.com/altendky/9f942709dfc2f33019723ffff43260b1
> 
> Since I already had it open:
>    https://docs.python.org/3/extending/newtypes.html#weakref-support

They aren't because I don't really see the point. Bound signals only exist during the period of an emit(), connect() or disconnect(). Having said that, bound methods are weak referenceable.

Unfortunately the limited API does not support the setting of tp_weakreferencelist so adding support is not as simple as the docs suggest.

I'll add it to the TODO list - but not high priority.

Phil


More information about the PyQt mailing list