-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Incremental mode crashes on #type: ignore
comment on module when it was previously imported
#1904
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
Comments
# type: ignore
and incremental mode#type: ignore
comment on module import
#type: ignore
comment on module import#type: ignore
comment on module when it was previously imported
Michael0x2a
pushed a commit
to Michael0x2a/mypy
that referenced
this issue
Jul 19, 2016
Previously, the semantic analyzer seemed to always mark import symbols as being of kind MODULE_REF during the third pass and did not preserve whether the module was previously marked with the `# type: ignore` comment or not. This caused a contradiction in some cases when mypy was run in incremental mode: suppose file a.py imported file b.py, and marked that import with the ignore annotation. Since the import is being ignored, mypy would not register that import as a dependency, but since the import (during the previous run) was marked as a MODULE_REF, mypy would attempt to load that module anyways in some cases. This commit fixes python#1904.
Could be caused by #1911? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Suppose you have the following two files:
a.py
b.py
# This file can be empty or non-empty
If you delete
.mypy_cache
then runmypy -i b.py a.py
twice, you obtain the following error the second time you run mypy:However, just running
mypy -i a.py
twice or swapping the order of the files and runningmypy -a a.py b.py
appears to both work fine -- it appears that incremental mode does not behave correctly when it first parses a module normally then encounters it a second time when it's annotated with# type: ignore
.The text was updated successfully, but these errors were encountered: