-
-
Notifications
You must be signed in to change notification settings - Fork 34k
bpo-44653: Support typing.Union in parameter substitution of the union type #27232
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
bpo-44653: Support typing.Union in parameter substitution of the union type #27232
Conversation
d57f09e to
a74e69f
Compare
Fidget-Spinner
left a comment
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 but please see my message on the bpo. There is another bug in the substitution.
| @@ -0,0 +1 @@ | |||
| Support ``typing.Union`` in parameter substitution of the union type. | |||
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.
Maybe this is more specific:
| Support ``typing.Union`` in parameter substitution of the union type. | |
| Flatten ``typing.Union`` during parameter substitution of the union type. |
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.
Is it better? Before this PR typing.Union was not supported at all.
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.
Hmm oh right I forgot. I think it's good to also mention that the arguments are flattened though, since none of the other types are treated like that. Some people might expect (int | T)[Union[str, int]] to become int | Union[str, int].
| Support ``typing.Union`` in parameter substitution of the union type. | |
| Support ``typing.Union`` in parameter substitution of the union type. | |
| Arguments in ``typing.Union`` are flattened and merged into the | |
| union type. |
|
There is more general approach in #27247. |
|
Closing in favor of GH-27247. |
https://bugs.python.org/issue44653