-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
File shadowing with --follow-imports=skip can cause crashes in incremental and daemon mode #6935
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
I guess a workaround would be to add a |
Yes, I think an |
One possible fix would be to define a set of "core" library modules that will always be looked up from typeshed. If any module outside typeshed has a name conflict with a core module, mypy would generate a blocking error and ignore the module. The error message should be accompanied with notes indicating common workarounds, such as renaming the module or adding a missing |
I think this is fixed by #13155? We should give a blocking error if this occurs. |
This may or may not be fixed, because this behavior is quite subtle. We will need to verify if it still happens (we don't have a simple repro unfortunately). |
Imagine the following scenario: One uses
--follow-imports=skip
and then adds a filesome_dir/some_file.py
to the build. If there is a file in thesome_dir
called e.g.types.py
that is not in the build, then this will cause actual typeshedtypes.pyi
being silently kicked out of the build.Although such behavior is IMO counterintuitive, it is technically correct (according to the current import resolution specs). The problem however is that this can cause crashes. I was not able to minimize the repros, but here are two tracebacks. One from the normal incremental mode:
and another from the fine-grained incremental mode
The text was updated successfully, but these errors were encountered: