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

Allow to ignore type errors per line specifically for mypy #18134

Closed
mar10 opened this issue Nov 9, 2024 · 1 comment
Closed

Allow to ignore type errors per line specifically for mypy #18134

mar10 opened this issue Nov 9, 2024 · 1 comment
Labels

Comments

@mar10
Copy link

mar10 commented Nov 9, 2024

Feature

Allow to ignore type errors specifically for mypy, in a way that will not interfere with other type checkers.

Suggestion:

val: str = None  # mypy: ignore 

Note that the example above would correctly report an error. It should just show the proposed syntax.
See #18133 for a real-word example.

Pitch

mypy, like any other library, may have bugs, or report warnings that we deliberately want to ignore.

This page suggests

If your code uses any of the above unsupported features and is causing errors when mypy checks your code, you can bypass it by adding # type: ignore to the line that causes the error.

This however is not an option if other type checkers, such as pyright do not report an error.
For example if pyright correctly accepts a line, it will correctly report an error Unnecessary "# type: ignore" comment

@mar10 mar10 added the feature label Nov 9, 2024
@hamdanal
Copy link
Collaborator

hamdanal commented Nov 9, 2024

Duplicate of #12358

@hamdanal hamdanal marked this as a duplicate of #12358 Nov 9, 2024
@hamdanal hamdanal closed this as not planned Won't fix, can't repro, duplicate, stale Nov 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants