Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mypy in 3.10 does not respect the python version when checking .pyi files #13635

Closed
rchui opened this issue Sep 8, 2022 · 3 comments
Closed
Labels
bug mypy got something wrong

Comments

@rchui
Copy link

rchui commented Sep 8, 2022

Mypy installed in a python 3.10 docker container fails to parse a .pyi file with the following error:

usr/local/lib/python3.10/site-packages/numpy/__init__.pyi:636: error: Positional-only parameters are only supported in Python 3.8 and greater
Found 1 error in 1 file (errors prevented further checking)

To Reproduce

  1. docker run -it --rm python:3.10 bash
  2. pip install numpy mypy
  3. Create a test.py with:
import numpy
  1. Run mypy test.py

Expected Behavior

I expect mypy to be able to parse this .pyi file successfully given that it is being run from a python 3.10 interpreter. The error fails because it attempts to parse it with an incompatible version that does not have positional-only parameters.

I am also unable to squash this error because it seems to happen at a stage where errors can't be silenced.

Actual Behavior

The above error occurs. I have tested that this error does not occur in python 3.9. It occurs across multiple operating systems including MacOS and Linux, across both amd64 and arm64 architectures, across multiple versions of mypy, and multiple versions of numpy

Your Environment

  • Mypy version used: 0.971
  • Mypy command-line flags: None
  • Mypy configuration options from mypy.ini (and other config files): None
  • Python version used: 3.10
  • Operating system and version: MacOS
@rchui rchui added the bug mypy got something wrong label Sep 8, 2022
@AlexWaygood
Copy link
Member

Duplicate of #13499

@AlexWaygood AlexWaygood marked this as a duplicate of #13499 Sep 8, 2022
@AlexWaygood AlexWaygood closed this as not planned Won't fix, can't repro, duplicate, stale Sep 8, 2022
@AlexWaygood
Copy link
Member

See my comments here: #13627 (comment)

@hauntsaninja
Copy link
Collaborator

(In particular, the easiest fix is to stick with Python 3.10.6 for now)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug mypy got something wrong
Projects
None yet
Development

No branches or pull requests

3 participants