-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
is_literal broken with new typing_extensions #100
Comments
Pydantic seems to have a similar check, potentially relevant discussion at pydantic/pydantic#5821 (comment) |
You'll probably want a fix similar to pydantic/pydantic#5826 |
Yeah. I will make a PR soon. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
typing_inspect.is_literal
is broken whentyping-extensions-4.6.0
is installed. The following simple check fails. Installingtyping-extensions-4.5.0
makes it work.While
typing_extensions
made some changes in their latest release I believe it didn't introduce any backwards incompatible changes and I would argue the cause is a bug intyping_inspect
. It seems to count ontyping.Literal
andtyping_extensions.Literal
being the same. It importsLiteral
fromtyping_extensions
(here) and uses that for theis_literal
check (here). As far as I can figure out this assumption is unfounded as it was never documented that the two types would be the same, they just happened to be so for a while.typing-extensions-4.6.0
was released earlier today. According to its changelog it includes a bugfix ontyping_extensions.Literal
. Indeed, while ontyping-extensions-4.5.0
typing.Literal is typing_extensions.Literal
this is no longer the case for the new version. As far as I can tell they did not introduce any backwards incompatible changes.I tested this on Python 3.9.15. The issue does not seem to be present on 3.10.10, there
typing.Literal is typing_extensions.Literal
still holds.EDIT: shifted the text around a bit in an effort to make it more readable
The text was updated successfully, but these errors were encountered: