-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Fix dmypy on windows when compiled with mypyc #6365
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
Conversation
dmypy currently crashes on windows when compiled with mypyc (since 0.660; it has *never* worked, I believe). The root cause here is the abusive use of the platform variable, which we set to 'mypyc', to tell bogus_type.py that mypyc is being used. This (obviously) interferes with our platform checks, causing mypyc to spuriously think code is unreachable, but because of the minutae of how our platform checks were structured and which files are compiled, this only breaks things for the windows daemon. Switch to using always_true/always_false instead of abusing platform.
If we don't want to require using We could also make it so that mypy understands |
There's also a question of whether this justifies a 0.671. On one hand, it is really bad. On the other hand, nobody noticed it in 0.660, where it was also present. |
In general our policy is, if it's not a regression it doesn't deserve a bugfix release. I don't mind that it requires a config file to type-check -- in fact I've frequently forgotten to pass that and found that I'd made some typing mistake only when CI called it out. |
Thinking about it more I seem to recall there might be some typeshed-related issue? @JelleZijlstra do you remember if that is the case? |
Do you mean whether there is a typeshed issue that might justify releasing 0.671? The only problem I've seen reported is the most recent comment at python/typeshed#2760, which doesn't seem too bad. |
No, I mean an issue with the typeshed tests if mypy only typechecks with a configuration file present |
Oh, sorry. I'm not aware of anything specific, but the typeshed tests do run some of the mypy test suite, including the self check. If anything breaks there's it's surely fixable by tweaking the Travis configuration. |
All right I think I want to merge this |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this makes sense. I look forward to being able to use mypyc-dmypy on Windows :P
dmypy currently crashes on windows when compiled with mypyc
(since 0.660; it has never worked, I believe).
The root cause here is the abusive use of the platform variable,
which we set to 'mypyc', to tell bogus_type.py that mypyc is being used.
This (obviously) interferes with our platform checks, causing mypyc to
spuriously think code is unreachable, but because of the minutae of
how our platform checks were structured and which files are compiled,
this only breaks things for the windows daemon.
Switch to using always_true/always_false instead of abusing platform.
There is a downside to this fix, though (which is the reason I abused platform in the first place instead of using always_true/always_false): mypy will no longer typecheck without its config file, since it needs
always_false = MYPYC
to be set. If this is a major problem, I'll need to look for another solution.