@@ -764,11 +764,11 @@ of the above sections.
764764 Note that :option: `--strict-equality-for-none <mypy --strict-equality-for-none> `
765765 only works in combination with :option: `--strict-equality <mypy --strict-equality> `.
766766
767- .. option :: --strict-bytes
767+ .. option :: --no- strict-bytes
768768
769- By default, mypy treats ``bytearray `` and ``memoryview `` as subtypes of ``bytes `` which
770- is not true at runtime. Use this flag to disable this behavior. `` --strict-bytes `` will
771- be enabled by default in * mypy 2.0 * .
769+ Treat ``bytearray `` and ``memoryview `` as subtypes of ``bytes ``. This is not true
770+ at runtime and can lead to unexpected behavior. This was the default behavior prior
771+ to mypy 2.0.
772772
773773 .. code-block :: python
774774
@@ -777,10 +777,12 @@ of the above sections.
777777 with open (" binary_file" , " wb" ) as fp:
778778 fp.write(buf)
779779
780- f(bytearray (b " " )) # error: Argument 1 to "f" has incompatible type "bytearray"; expected "bytes"
781- f(memoryview (b " " )) # error: Argument 1 to "f" has incompatible type "memoryview"; expected "bytes"
780+ # Using --no-strict-bytes disables the following errors
781+ f(bytearray (b " " )) # Argument 1 to "f" has incompatible type "bytearray"; expected "bytes"
782+ f(memoryview (b " " )) # Argument 1 to "f" has incompatible type "memoryview"; expected "bytes"
782783
783- # If `f` accepts any object that implements the buffer protocol, consider using:
784+ # If `f` accepts any object that implements the buffer protocol,
785+ # consider using Buffer instead:
784786 from collections.abc import Buffer # "from typing_extensions" in Python 3.11 and earlier
785787
786788 def f (buf : Buffer) -> None :
0 commit comments