From 11ac96872e637e836c23999eabf4bc9a7c27afbd Mon Sep 17 00:00:00 2001 From: toofar Date: Mon, 13 Nov 2023 20:23:06 +1300 Subject: [PATCH] Downgrade mypy for now I believe we are being afflicted by this issue: https://github.com/python/mypy/issues/16451 Although I'm not 100% sure because there is a lot going on in this function and I haven't managed to grok it. The mypy 1.7 release [notes][1.7] say you can disable the new type inference by running `tox -e mypy-pyqt6 -- --old-type-inference` and indeed mypy passes with that. So either our type hints are incorrect or we are hitting a bug. Considering the inferred type hint has a `Never` in it I'm leading toward it being a bug. So I'll bump the mypy version down and hopefully next week the issue will be resolved. The mypy output before this commit was: mypy-pyqt6: commands[0]> .tox/mypy-pyqt6/bin/python -m mypy --always-true=USE_PYQT6 --always-false=USE_PYQT5 --always-false=USE_PYSIDE6 --always-false=IS_QT5 --always-true=IS_QT6 --always-true=IS_PYQT --always-false=IS_PYSIDE qutebrowser qutebrowser/utils/qtutils.py:239: error: Argument 1 to "contextmanager" has incompatible type "Callable[[str, bool, str], Iterator[IO[AnyStr]]]"; expected "Callable[[str, bool, str], Iterator[IO[Never]]]" [arg-type] @contextlib.contextmanager ^ qutebrowser/misc/lineparser.py: note: In member "save" of class "LineParser": qutebrowser/misc/lineparser.py:168: error: Need type annotation for "f" [var-annotated] with qtutils.savefile_open(self._configfile, self._binary) as f: ^ qutebrowser/misc/lineparser.py: note: In member "save" of class "LimitLineParser": qutebrowser/misc/lineparser.py:226: error: Need type annotation for "f" [var-annotated] with qtutils.savefile_open(self._configfile, self._binary) as f: ^ qutebrowser/config/configfiles.py: note: In member "_save" of class "YamlConfig": qutebrowser/config/configfiles.py:292: error: Need type annotation for "f" [var-annotated] with qtutils.savefile_open(self._filename) as f: ^ qutebrowser/misc/sessions.py: note: In member "save" of class "SessionManager": qutebrowser/misc/sessions.py:343: error: Need type annotation for "f" [var-annotated] with qtutils.savefile_open(path) as f: [1.7]: https://mypy-lang.blogspot.com/2023/11/mypy-17-released.html --- misc/requirements/requirements-mypy.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/misc/requirements/requirements-mypy.txt b/misc/requirements/requirements-mypy.txt index 497ac9b92fc..b8c88cfc089 100644 --- a/misc/requirements/requirements-mypy.txt +++ b/misc/requirements/requirements-mypy.txt @@ -6,7 +6,7 @@ importlib-resources==6.1.1 Jinja2==3.1.2 lxml==4.9.3 MarkupSafe==2.1.3 -mypy==1.7.0 +mypy==1.6.1 mypy-extensions==1.0.0 pluggy==1.3.0 Pygments==2.16.1