File tree Expand file tree Collapse file tree 3 files changed +12
-3
lines changed Expand file tree Collapse file tree 3 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -1449,9 +1449,7 @@ def set_strict_flags() -> None:
1449
1449
process_cache_map (parser , special_opts , options )
1450
1450
1451
1451
# Process --strict-bytes
1452
- if options .strict_bytes :
1453
- options .disable_bytearray_promotion = True
1454
- options .disable_memoryview_promotion = True
1452
+ options .process_strict_bytes ()
1455
1453
1456
1454
# An explicitly specified cache_fine_grained implies local_partial_types
1457
1455
# (because otherwise the cache is not compatible with dmypy)
Original file line number Diff line number Diff line change @@ -466,6 +466,16 @@ def process_incomplete_features(
466
466
if feature in COMPLETE_FEATURES :
467
467
warning_callback (f"Warning: { feature } is already enabled by default" )
468
468
469
+ def process_strict_bytes (self ) -> None :
470
+ # Sync `--strict-bytes` and `--disable-{bytearray,memoryview}-promotion`
471
+ if self .strict_bytes :
472
+ # backwards compatibility
473
+ self .disable_bytearray_promotion = True
474
+ self .disable_memoryview_promotion = True
475
+ elif self .disable_bytearray_promotion and self .disable_memoryview_promotion :
476
+ # forwards compatibility
477
+ self .strict_bytes = True
478
+
469
479
def apply_changes (self , changes : dict [str , object ]) -> Options :
470
480
# Note: effects of this method *must* be idempotent.
471
481
new_options = Options ()
Original file line number Diff line number Diff line change @@ -2003,6 +2003,7 @@ def warning_callback(msg: str) -> None:
2003
2003
options .process_incomplete_features (
2004
2004
error_callback = error_callback , warning_callback = warning_callback
2005
2005
)
2006
+ options .process_strict_bytes ()
2006
2007
2007
2008
try :
2008
2009
modules = build_stubs (modules , options , find_submodules = not args .check_typeshed )
You can’t perform that action at this time.
0 commit comments