Skip to content

Commit c39f026

Browse files
committed
Enable strict_bytes by default
1 parent ac6151a commit c39f026

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

mypy/main.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -870,9 +870,9 @@ def add_invertible_flag(
870870
)
871871

872872
add_invertible_flag(
873-
"--strict-bytes",
874-
default=False,
875-
strict_flag=False,
873+
"--no-strict-bytes",
874+
default=True,
875+
dest="strict_bytes",
876876
help="Disable treating bytearray and memoryview as subtypes of bytes",
877877
group=strictness_group,
878878
)

mypy/options.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ def __init__(self) -> None:
217217
self.strict_equality = False
218218

219219
# Disable treating bytearray and memoryview as subtypes of bytes
220-
self.strict_bytes = False
220+
self.strict_bytes = True
221221

222222
# Deprecated, use extra_checks instead.
223223
self.strict_concatenate = False
@@ -386,8 +386,8 @@ def __init__(self) -> None:
386386
# (undocumented feature).
387387
self.export_ref_info = False
388388

389-
self.disable_bytearray_promotion = False
390-
self.disable_memoryview_promotion = False
389+
self.disable_bytearray_promotion = True
390+
self.disable_memoryview_promotion = True
391391
self.force_uppercase_builtins = False
392392
self.force_union_syntax = False
393393

mypy/test/testargs.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
from mypy.main import infer_python_executable, process_options
1414
from mypy.options import Options
15-
from mypy.test.helpers import Suite, assert_equal
15+
from mypy.test.helpers import Suite
1616

1717

1818
class ArgSuite(Suite):
@@ -21,7 +21,7 @@ def test_coherence(self) -> None:
2121
_, parsed_options = process_options([], require_targets=False)
2222
# FIX: test this too. Requires changing working dir to avoid finding 'setup.cfg'
2323
options.config_file = parsed_options.config_file
24-
assert_equal(options.snapshot(), parsed_options.snapshot())
24+
assert options.snapshot() == parsed_options.snapshot()
2525

2626
def test_executable_inference(self) -> None:
2727
"""Test the --python-executable flag with --python-version"""

0 commit comments

Comments
 (0)