-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
There is no way to ignore valid-type
error for valid type alias type
statements
#16607
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
Labels
bug
mypy got something wrong
Comments
I don't know if there's much value in suppressing this error in mypy. All subsequent type evaluation based on that type alias will generate errors as well. If you're a mypy user, it's probably best to simply avoid PEP 695 syntax until this support is added. If you want to explore the new syntax while you're waiting for this support to appear in mypy, you can try the pyright playground. |
hauntsaninja
added a commit
to hauntsaninja/mypy
that referenced
this issue
Dec 4, 2023
This is basically a pre-existing bug and affects other errors that ASTConverter might raise, like merging overloads. It could vaguely be nice to move all the set_file_ignored_lines into fastparse, instead of BuildManager.parse_file. Could also clean up the ignore_errors logic a little bit more. Fixes python#16607
JukkaL
pushed a commit
that referenced
this issue
Dec 7, 2023
This is basically a pre-existing bug and affects other errors that ASTConverter might raise, like merging overloads. It could vaguely be nice to move all the set_file_ignored_lines into fastparse, instead of BuildManager.parse_file. Could also clean up the ignore_errors logic a little bit more. Fixes #16607
wesleywright
pushed a commit
that referenced
this issue
Dec 7, 2023
This is basically a pre-existing bug and affects other errors that ASTConverter might raise, like merging overloads. It could vaguely be nice to move all the set_file_ignored_lines into fastparse, instead of BuildManager.parse_file. Could also clean up the ignore_errors logic a little bit more. Fixes #16607
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Bug Report
Python 3.12 added support for the
type
statement as described in PEP 695. As discussed in #15238, Mypy does not yet support PEP 695. Unfortunately, it seems that Mypy also does not support ignoring error codes for lines usingtype
.To Reproduce
After reading the documentation at https://mypy.readthedocs.io/en/stable/error_codes.html#error-codes:
In
mypy.ini
:In a Python source file:
On the command line:
Expected Behavior
All five of these examples should tell Mypy ignore the
valid-type
error code.Actual Behavior
The error code is not ignored. In every case, the following error is still generated:
In a few of the cases, an error like
is generated.
Your Environment
mypy.ini
(and other config files): see aboveThe text was updated successfully, but these errors were encountered: