-
-
Notifications
You must be signed in to change notification settings - Fork 45
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
Fix typing.Literal
support for Python 3.9
#104
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Can you squash and force push all the commits as one to retain you as an author before the merge?
Python 3.9.1 changed the `type()` of `Literal` instances to be `_LiteralGenericAlias` instead of `_GenericAlias`. `is_literal_type()` assumed the change took place in Python 3.9.0 and checked for it accordingly. Because the assumption was incorrect, it failed to detect `Literal` types in Python versions [3.9.0, 3.9.1). This commit changes `is_literal_type()` to check `PY_310_MIN` instead of `PY_39_MIN` to fix the issue.
7b45d93
to
aba3857
Compare
Thanks 👍 |
@Fatal1ty can we get this fix into a release please? |
@fabiopedrosa Can it wait a bit more? I'm planning to make a release this or next week after finishing the following issues:
Good news is I'm almost done with the first two, just need to update the documentation. |
Python 3.9.1 changed the
type()
ofLiteral
instances to be_LiteralGenericAlias
instead of_GenericAlias
.is_literal_type()
assumed the change took place in Python 3.9.0 and checked for it accordingly. Because the assumption was incorrect, it failed to detectLiteral
types in Python versions [3.9.0, 3.9.1).is_literal_type()
was changed to checkPY_310_MIN
instead ofPY_39_MIN
(and check forPY_39
separately)test_is_literal_unsupported_python()
was updated to mock the updated conditionstest_is_literal_py39()
was added to test backwards compatibility for Python versions [3.9.0, 3.9.1)Fixes #103