[PyQt] moveToThread() does not cope with functools.partial

Phil Thompson phil at riverbankcomputing.com
Tue Apr 23 16:52:27 BST 2013


On Tue, 23 Apr 2013 15:27:17 +0200, Giuseppe Corbelli
<giuseppe.corbelli at copanitalia.com> wrote:
> On 23/04/2013 14:57, Phil Thompson wrote:
>>> Please see the minimal test code below. In short connecting a signal
to
>> a
>>> functools.partial slot breaks the expected moveToThread behaviour.
>>> Reasonable, I'd say, once you think about it. I'm just asking some
>>> suggestion
>>> about how this issue can be addressed. I thought about reimplementing
>> some
>>> signal class with a connect_partial method that stores bound args.
>>> Python 2.7.3, Qt 4.8.2, PyQt 4.10 on Linux.
>>
>> Should be fixed in tonight's PyQt4 snapshot.
> 
> I'm curious to understand how you fixed it. Can I ask for a diff or some
> other 
> pointer to look at?

Look at get_receiver() in qpy/QtCore/qpycore_pyqtboundsignal.cpp. It just
strips off the functools.partial wrappers until it gets to the QObject. The
proxy that is created is then moved to the same thread as the QObject.

Phil


More information about the PyQt mailing list