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.)
Hello, I see @AlexWaygood recently backported some fixes to
Literalfor 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 causingLiteral[True]to returnLiteral[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 ofLiteralintyping_extensionsthen 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
Literaland the 3.11 one well enough to do it properly.)