Details
Description
I found the following issue when passing the return value of a method that should return a widget returned None instead to QLayout.addWidget().
For the following code example, all calls to addWidget result in a TypeError, except the one with None. This one causes a segmentation fault. My expectation would be that it raises a TypeError as well.
from PySide6.QtWidgets import QApplication, QHBoxLayout app = QApplication() layout = QHBoxLayout() try: layout.addWidget(1) except TypeError: pass try: layout.addWidget("foo") except TypeError: pass try: layout.addWidget(None) except TypeError: pass app.quit()
Attachments
Issue Links
- relates to
-
PYSIDE-2440 Type hints should indicate optionality
- Closed
For Gerrit Dashboard: PYSIDE-2638 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
547483,3 | Fix crash when adding None to a QLayout | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 |
547835,2 | Fix crash when adding None to a QLayout | 6.6 | pyside/pyside-setup | Status: MERGED | +2 | 0 |
547931,2 | Fix crash when adding None to a QLayout | tqtc/lts-6.5 | pyside/tqtc-pyside-setup | Status: MERGED | +2 | 0 |