Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 385a27a

Browse files
authored
Fix dmypy on windows when compiled with mypyc (#6365)
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.
1 parent c6393af commit 385a27a

3 files changed

Lines changed: 4 additions & 3 deletions

File tree

mypy/bogus_type.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919

2020
# This won't ever be true at runtime, but we consider it true during
2121
# mypyc compilations.
22-
if sys.platform == 'mypyc':
22+
MYPYC = False
23+
if MYPYC:
2324
Bogus = FlexibleAlias[T, Any]
2425
else:
2526
Bogus = FlexibleAlias[T, T]

mypy_bootstrap.ini

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,4 @@ disallow_any_unimported = True
1212
warn_redundant_casts = True
1313
warn_unused_configs = True
1414
show_traceback = True
15-
# Set the platform to something nonsense to signal to make Bogus = Any.
16-
platform = mypyc
15+
always_true = MYPYC

mypy_self_check.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ disallow_any_unimported = True
1212
warn_redundant_casts = True
1313
warn_unused_configs = True
1414
show_traceback = True
15+
always_false = MYPYC

0 commit comments

Comments
 (0)