Skip to content

Inconsistent behavior of # type: ignore for whole file between python versions #7785

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

Closed
isac322 opened this issue Oct 24, 2019 · 1 comment · Fixed by #7789
Closed

Inconsistent behavior of # type: ignore for whole file between python versions #7785

isac322 opened this issue Oct 24, 2019 · 1 comment · Fixed by #7789

Comments

@isac322
Copy link

isac322 commented Oct 24, 2019

  • Are you reporting a bug, or opening a feature request?

A bug

  • Please insert below the code you are checking with mypy

test.py:

# type: ignore

def test1():
    return 1

print(test1())
  • What is the actual output?

with mypy test.py --strict:

Success: no issues found in 1 source file

with mypy test.py --strict -2:

test.py:1: error: unused 'type: ignore' comment
test.py:3: error: Function is missing a return type annotation
test.py:6: error: Call to untyped function "test1" in typed context
Found 3 errors in 1 file (checked 1 source file)
  • What is the output you expect?

both mypy test.py --strict and mypy test.py --strict -2:

Success: no issues found in 1 source file
  • What are the versions of mypy and Python you are using?

    • mypy: 0.740
    • python: 3.7.4
  • Do you see the same issue after installing mypy from Git master?

Yes (on 09c1fc7)

@brandtbucher
Copy link
Member

I see the issue here. I'll have a patch up soon.

Nice catch @isac322!

JukkaL pushed a commit that referenced this issue Oct 30, 2019
Fixes #7785. This was a mistake in my original PR that introduced the feature 
(#6830). I forgot to copy one of the changes in `fastparse.py` to `fastparse2.py`.

It's an embarrassingly simple fix. I also included a regression test for good measure.
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

Successfully merging a pull request may close this issue.

2 participants