Skip to content

Backport fixes to Literal from 3.11? #147

@dfremont

Description

@dfremont

Hello, I see @AlexWaygood recently backported some fixes to Literal for Python versions prior to 3.9.1. Might you consider doing the same for some further fixes (last commit here) that only appeared in 3.11? Those issues -- basically problems with the type cache causing Literal[True] to return Literal[1] or vice versa when both are used -- break my code since I use annotations for runtime typechecking. If you could put the 3.11 implementation of Literal in typing_extensions then everybody could use it on older Python versions without needing their own monkeypatch to fix this problem. Thanks!

(If you would like I can try putting together a PR for this, although I'm not sure I understand the differences between your version of Literal and the 3.11 one well enough to do it properly.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions