Skip to content

Confine PEP 695 type annotation rewrites (UP040) to non-runtime contexts #6434

@charliermarsh

Description

@charliermarsh

See the comment here: #6289 (comment). PEP 695 type aliases can't be used for runtime typing, so we need to limit the cases in which we flag and rewrite them. For starters, we could consider limiting to .pyi files, where it should ~always be safe. We could then extend to "private" type aliases that aren't used in runtime contexts within a file.

Alternatively, we could just turn off this rule when keep-runtime-typing is set, and leave it as-is.

Metadata

Metadata

Assignees

No one assigned

    Labels

    python312Related to Python 3.12ruleImplementing or modifying a lint rule

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions