qt6 mypy: Fix handling of AbstractTab.is_deleted()

This commit is contained in:
Florian Bruhin 2023-06-29 22:10:44 +02:00
parent 7b1029653f
commit d13bd0675d
1 changed files with 7 additions and 4 deletions

View File

@ -1181,8 +1181,7 @@ class AbstractTab(QWidget):
@pyqtSlot(bool)
def _on_load_finished(self, ok: bool) -> None:
assert self._widget is not None
# FIXME:mypy PyQt6-stubs issue?
if sip.isdeleted(self._widget):
if self.is_deleted():
# https://github.com/qutebrowser/qutebrowser/issues/3498
return
@ -1342,5 +1341,9 @@ class AbstractTab(QWidget):
def is_deleted(self) -> bool:
assert self._widget is not None
# FIXME:mypy PyQt6-stubs issue?
return sip.isdeleted(self._widget)
# FIXME:v4 cast needed for QtWebKit
if machinery.IS_QT6:
widget = cast(QWidget, self._widget)
else:
widget = self._widget
return sip.isdeleted(widget)