-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Internal error appearing only with looser settings than defaults #9493
Comments
This may or may not be easy to fix. The problem is probably that suppressing errors in earlier stages of the analysis sometimes causes Any types to appear in places where later stages don’t expect them. But it may not be easy to track down the source of the Any that’s causing the crash (if it is one). |
Thanks for the reply, that makes sense and is indeed very unfortunate. Would it be helpful if I write a script to try out different combinations of the config settings I have, and find the minimal such set where the bug still happens? Or is there any other way I can be helpful here? |
What would be most helpful is a short repro. This is not easy to script though. Start by looking at the file and line printed at the end of the crash. |
This is a duplicate of #9437, so let's move discussion there. That issue mentions |
Bug Report
mypy
crashes with an internal error when scanning thearviz
open-source project on the currentmaster
branch when using a custom (I believe purely looser) configuration thanmypy
's default:Running with
mypy
's defaults does not result in a crash, andmypy
I believe correctly reports many violations.I found this while building
typing_copilot
, an open-source tool to make it easier to start using mypy in large codebases. The tool is able to find the strictest possiblemypy
configuration that produces no errors, and therefore enables a ratcheting workflow:typing_copilot
to initially find the strictest passing configuration, set that as your startingmypy.ini
filemypy
in a CI environment to prevent regressions.typing_copilot
to tighten themypy.ini
as your type coverage improves.typing_copilot
in a CI environment to enforce that any timemypy.ini
could be tightened, it actually gets tightened.Sadly, this issue is preventing that initial search for the strictest passing configuration from working, since the configuration which causes the error is the loosest configuration supported by
typing_copilot
and therefore represents the "starting point" of the search.Here's a link to the corresponding issue in its repo: obi1kenobi/typing_copilot#1
To Reproduce
arviz
project repo and check out themaster
branch (commit hash24ce65a44d8b48eb9377fdee38246d059ce3d201
at time of writing).virtualenv
, install the project's dependencies from the severalrequirements.txt
files. Ensure you havexarray==0.16.1
installed, since that dependency appears to play a part in the error.custom_mypy.ini
.mypy --config-file ./custom_mypy.ini -p arviz --show-traceback
and observemypy
crash with an internal error.mypy -p arviz --show-traceback
(i.e. using the default configuration) and observe thatmypy
does not crash.Expected Behavior
I did not expect
mypy
to crash, and I especially was surprised to see that looseningmypy
configuration makes it crash.Actual Behavior
When run with the custom config,
mypy
crashes with the following traceback:Your Environment
master
--0.790+dev.0b4a2c9d8edb57e2b61219c96eefe010073a5c14
--config-file ./custom_mypy.ini -p arviz --show-traceback
mypy.ini
(and other config files): See top of issue postI'm not familiar with the
mypy
codebase, but I'd love to help in any way I can since this is blocking my progress ontyping_copilot
, which I hope will be a tool useful to anyone seeking to start usingmypy
in a large existing Python codebase.The text was updated successfully, but these errors were encountered: