Details
Description
This code segfaults on Windows and Linux, Python 3.11.6 and 3.12.0, PySide6 6.5.3 and 6.6.0:
from PySide6.QtCore import Signal class Signaler: my_signal = Signal() def __init__(self): self.my_signal.connect(self.fun) def fun(self): pass Signaler() print("Done") # never printed
Before crashing, it prints
AttributeError: 'Signaler' object has no attribute ''
It appears the problem is that Signaler does not derive from QObject. Nonetheless, Python should not crash, and a useful error message should be printed.
Attachments
For Gerrit Dashboard: PYSIDE-2510 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
514431,2 | Set error when instantiating a Signal on a non-QObject | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 |
514471,2 | Set error when instantiating a Signal on a non-QObject | 6.6 | pyside/pyside-setup | Status: MERGED | +2 | 0 |
514516,2 | Set error when instantiating a Signal on a non-QObject | 6.5 | pyside/pyside-setup | Status: MERGED | +2 | 0 |