Skip to content

String type annotations break backwards compatibility #860

@adebrecht661

Description

@adebrecht661

3.2 changed some type annotations to use string annotations instead of types, e.g.

3.1: DictRow: TypeAlias = Dict[str, Any]
3.2: DictRow: TypeAlias = "dict[str, Any]"

This breaks any code using | for type unions with these types (DictRow | tuple, for example), which worked in 3.1 but in 3.2 raises a TypeError: unsupported operand type(s) for |: 'str' and 'type'.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions