Skip to content

Bump mypy to 1.19.1#145956

Merged
sobolevn merged 2 commits intopython:mainfrom
brianschubert:bump-mypy-1191
Mar 15, 2026
Merged

Bump mypy to 1.19.1#145956
sobolevn merged 2 commits intopython:mainfrom
brianschubert:bump-mypy-1191

Conversation

@brianschubert
Copy link
Contributor

Closes #145950

New mypy errors:

Lib/test/libregrtest/utils.py:174: error: Incompatible types in assignment (expression has type "Callable[[_ExceptHookArgs], object]", variable has type "Callable[..., None] | None")  [assignment]
        orig_threading_excepthook = threading.excepthook
                                    ^~~~~~~~~~~~~~~~~~~~
Tools/clinic/libclinic/clanguage.py:67: error: Module has no attribute "cpp" [attr-defined]
            self.cpp = libclinic.cpp.Monitor(filename)
                       ^~~~~~~~~~~~~

First error is due to the return type of threading.excepthook changing from Any to object in a recent typeshed update.

The second error is due to the cpp submodule never being explicitly imported in clanguage's import graph, which can indeed lead to a runtime error:

>>> import libclinic.clanguage
>>> libclinic.clanguage.CLanguage("foo")
Traceback (most recent call last):
  File "<python-input-1>", line 1, in <module>
    libclinic.clanguage.CLanguage("foo")
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^
  File "/home/brian/Projects/open-contrib/cpython/Tools/clinic/libclinic/clanguage.py", line 67, in __init__
    self.cpp = libclinic.cpp.Monitor(filename)
               ^^^^^^^^^^^^^
AttributeError: module 'libclinic' has no attribute 'cpp'

It only works at the moment due to an implicit dependency on libclinic.cli being imported first, which imports libclinic.cpp.

@sobolevn sobolevn merged commit e167e06 into python:main Mar 15, 2026
68 checks passed
@miss-islington-app
Copy link

Thanks @brianschubert for the PR, and @sobolevn for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Mar 15, 2026
(cherry picked from commit e167e06)

Co-authored-by: Brian Schubert <brianm.schubert@gmail.com>
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Mar 15, 2026
(cherry picked from commit e167e06)

Co-authored-by: Brian Schubert <brianm.schubert@gmail.com>
@bedevere-app
Copy link

bedevere-app bot commented Mar 15, 2026

GH-145971 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.14 bugs and security fixes label Mar 15, 2026
@bedevere-app
Copy link

bedevere-app bot commented Mar 15, 2026

GH-145972 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.13 bugs and security fixes label Mar 15, 2026
sobolevn pushed a commit that referenced this pull request Mar 15, 2026
Bump mypy to 1.19.1 (GH-145956)
(cherry picked from commit e167e06)

Co-authored-by: Brian Schubert <brianm.schubert@gmail.com>
sobolevn pushed a commit that referenced this pull request Mar 15, 2026
Bump mypy to 1.19.1 (GH-145956)
(cherry picked from commit e167e06)

Co-authored-by: Brian Schubert <brianm.schubert@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants