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

PEP 585 support is broken again #17552

Closed
Tshimanga opened this issue Jul 21, 2024 · 3 comments
Closed

PEP 585 support is broken again #17552

Tshimanga opened this issue Jul 21, 2024 · 3 comments
Labels
bug mypy got something wrong

Comments

@Tshimanga
Copy link

Bug Report

#9873 is back.

To Reproduce

foo: list[int] = [1,2,3]

Expected Behavior

No Complaints.

Actual Behavior

error: "list" is not subscriptable, use "typing.List" instead  [misc]

Your Environment

  • Mypy version used: 1.11.0
  • Python version used: 3.11 & 3.12
@Tshimanga Tshimanga added the bug mypy got something wrong label Jul 21, 2024
@asottile-sentry
Copy link

works fine for me -- I suspect you're running mypy in an older python version and/or with a configuration setting selecting an older python:

$ mypy -c 'foo: list[int] = [1,2,3]'
Success: no issues found in 1 source file
$ mypy --version && python --version
mypy 1.11.0 (compiled: yes)
Python 3.12.2

@hauntsaninja hauntsaninja closed this as not planned Won't fix, can't repro, duplicate, stale Jul 22, 2024
@Tshimanga
Copy link
Author

Tshimanga commented Jul 22, 2024

I suspect you're running mypy in an older python version

No, I am running mypy 1.11.0 and python 3.12 (as I indicated in my environment details above)

@JukkaL
Copy link
Collaborator

JukkaL commented Oct 8, 2024

@Tshimanga Are you still experiencing the issue? Can you try creating a fresh venv using 3.9 or later, create an empty directory, and run mypy -c 'foo: list[int] = [1,2,3]', mypy --version and python --version in it? Can you also try running mypy --python-version 3.9 -c 'foo: list[int] = [1,2,3]'?

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

4 participants