From fd5403a9494187e472479e43bd54f5c20630e0b1 Mon Sep 17 00:00:00 2001 From: "Michael J. Sullivan" Date: Fri, 8 Feb 2019 17:20:38 -0800 Subject: [PATCH] Fix dmypy on windows when compiled with mypyc 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. --- mypy/bogus_type.py | 3 ++- mypy_bootstrap.ini | 3 +-- mypy_self_check.ini | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/mypy/bogus_type.py b/mypy/bogus_type.py index 835c99bea397..fcf8accd0794 100644 --- a/mypy/bogus_type.py +++ b/mypy/bogus_type.py @@ -19,7 +19,8 @@ # This won't ever be true at runtime, but we consider it true during # mypyc compilations. -if sys.platform == 'mypyc': +MYPYC = False +if MYPYC: Bogus = FlexibleAlias[T, Any] else: Bogus = FlexibleAlias[T, T] diff --git a/mypy_bootstrap.ini b/mypy_bootstrap.ini index 1c4f8a1a8cf4..3a6eee6449d2 100644 --- a/mypy_bootstrap.ini +++ b/mypy_bootstrap.ini @@ -12,5 +12,4 @@ disallow_any_unimported = True warn_redundant_casts = True warn_unused_configs = True show_traceback = True -# Set the platform to something nonsense to signal to make Bogus = Any. -platform = mypyc +always_true = MYPYC diff --git a/mypy_self_check.ini b/mypy_self_check.ini index c865d538bac6..fcc26f49a4b6 100644 --- a/mypy_self_check.ini +++ b/mypy_self_check.ini @@ -12,3 +12,4 @@ disallow_any_unimported = True warn_redundant_casts = True warn_unused_configs = True show_traceback = True +always_false = MYPYC