-
Notifications
You must be signed in to change notification settings - Fork 263
Backport get_origin() and get_args() #698
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
Backport get_origin() and get_args() #698
Conversation
The implementations come from CPython commit 427c84f13f77 with one small change – the get_origin's docstring mentions Annotated as it's also supported. get_origin() and get_args() introduced in [1] and modified in [2] to support Annotated. [1] python/cpython#13685 [2] python/cpython#18260
… 3.8 Otherwise typing_extensions.get_origin() would not recognize typing_extensions.Annotated on 3.8.
Well, I'm not sure what to do regarding the build failure:
It happens because even though 3.8 has |
Yeah, it looks like it belongs in the exclude list (maybe only in 3.8.x?) |
|
||
# Python 3.8 has get_origin() and get_args() but those implementations aren't | ||
# Annotated-aware, so we can't use those, only Python 3.9 versions will do. | ||
if sys.version_info[:3] >= (3, 9, 0): |
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.
sys.version_info[:2] >= (3, 9)
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. I'd wait a few days for @ilevkivskyi -- Ivan, if you're okay with my review just say so and I'll merge it.
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 👍
The implementations come from CPython commit 427c84f13f77 with one small
change – the get_origin's docstring mentions Annotated as it's also
supported.
get_origin() and get_args() introduced in [1] and modified in [2] to
support Annotated.
[1] python/cpython#13685
[2] python/cpython#18260