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

File-level ignore of specific error codes #8712

Closed
jvdwetering opened this issue Apr 23, 2020 · 2 comments
Closed

File-level ignore of specific error codes #8712

jvdwetering opened this issue Apr 23, 2020 · 2 comments

Comments

@jvdwetering
Copy link

I think this is a feature request, not a bug

Consider the following code (Python 3.7.4, mypy 0.770):

def f(x: int) -> None:
	return x
f("bla")

Running mypy --show-error-codes gives two errors (as expected):

error: No return value expected  [return-value]
error: Argument 1 to "f" has incompatible type "str"; expected "int"  [arg-type]

If I add a global ignore statement to the top of the file in the following manner:

# type: ignore[return-value]
def f(x: int) -> None:
	return x
f("bla")

I would expect only the first error type to be ignored, but instead mypy ignores both errors (which is what you would expect to happen if the first line is #type: ignore.

@brandtbucher
Copy link
Member

Seems like a duplicate of #7839, which is a bug.

@msullivan
Copy link
Collaborator

Agreed

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

No branches or pull requests

3 participants