Skip to content

Drop bytes/bytearray and bytes/memoryview promotions (PEP 688) #15313

Open
@JelleZijlstra

Description

@JelleZijlstra

PEP 688 (https://peps.python.org/pep-0688/#no-special-meaning-for-bytes) specifies that type checkers should stop treating bytes as implicitly equivalent to bytes | bytearray | memoryview. Mypy should implement this change.

We already have hidden flags to disable the promotions (added in #13952) and I have a draft PR that shows the impact of disabling them (#12661). I would suggest the following plan:

  • Promote --disable-bytearray-promotion and --disable-memoryview-promotion to public, documented flags now
  • The next time we increment mypy's major version number, flip the default

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions