Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
5.15.1
-
None
Description
When an argument that does not comply with the signature of the signal is used then no exceptions are thrown and it seems that it uses default arguments since in the case that the signature is a string an empty string is sent, and when it is an integer it is sends a 0, generating a silent error that is difficult to track.
MRE
import sys from PySide2.QtCore import QCoreApplication, QObject, Signal, QTimer class Foo(QObject): str_sig = Signal(str) int_sig = Signal(int) class Bar(QObject): def bar_slot(self, val): print(val) if __name__ == "__main__": app = QCoreApplication(sys.argv) foo = Foo() bar = Bar() foo.str_sig.connect(bar.bar_slot) foo.int_sig.connect(bar.bar_slot) foo.str_sig.emit(10) foo.int_sig.emit("fff") QTimer.singleShot(1000, QCoreApplication.quit) sys.exit(app.exec_())
Output:
0
Instead in pyqt5 a TypeError exception is thrown.
Attachments
Issue Links
- relates to
-
PYSIDE-1900 Invalid parameter type to Signal.emit results in crash
- Reported
Gerrit Reviews
For Gerrit Dashboard: PYSIDE-1428 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
348889,7 | signal: warn when wrong emit arg type is used | dev | pyside/pyside-setup | Status: NEW | -1 | 0 |