-
Bug
-
Resolution: Won't Do
-
P2: Important
-
None
-
6.9.0
-
None
Scenario:
- Signal has int parameter
- Slot has bool parameter
- Expectation is that functools.partial(self.slot, test=True) should somehow fit, ignoring the int
This snippet:
import functools from PySide6.QtCore import QObject, Signal, Slot class Test(QObject): sig = Signal(int) def __init__(self, parent=None): super().__init__(parent) self.sig.connect(functools.partial(self.slot, test=True)) # @Slot() def slot(self, test): pass t = Test() t.sig.emit(42)
results in:
TypeError: Test.slot() got multiple values for argument 'test'
or, when making test a keyword-only argument:
TypeError: Test.slot() takes 1 positional argument but 2 positional arguments (and 1 keyword-only argument) were given
( seterror_argument(), sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/errorhandler.py:118 )
but works with PyQt6 (and in PySide6 when removing the keyword argument and functools.partial).
I'd expect PySide to detect the signature of the partial object and call the slot with no arguments (like with a regular function). Right now it seems to assume the signature of the wrapped function or something?