Details
-
Bug
-
Resolution: Fixed
-
P4: Low
-
6.8.1
-
None
-
19d114233 (dev), 3677c9244 (6.8)
Description
QWidgets.pyi indicates that the return type of window() is optional:
def window(self) -> PySide6.QtWidgets.QWidget | None: ...
By contrast, I think by construction of QWidget. window() can never return None: either QWidget has no parent, in which case it becomes a window and window() returns itself; or QWidget has a parent, which is another QWidget for which one of the above is true.
from PySide6.QtWidgets import QWidget, QApplication
app = QApplication()
widget = QWidget(None)
print(widget.window())
Attachments
Issue Links
- relates to
-
PYSIDE-2440 Type hints should indicate optionality
- Closed
For Gerrit Dashboard: PYSIDE-2941 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
609303,3 | type hints: Fix some return annotations which should be optional, amended | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 |
609322,2 | type hints: Fix some return annotations which should be optional, amended | 6.8 | pyside/pyside-setup | Status: MERGED | +2 | 0 |