-
-
Notifications
You must be signed in to change notification settings - Fork 31.7k
bpo-44791: Fix substitution of ParamSpec in Concatenate with differen… #27518
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-44791: Fix substitution of ParamSpec in Concatenate with differen… #27518
Conversation
…t parameter expressions
This PR is stale because it has been open for 30 days with no activity. |
Sorry, I'd forgotten about this. Last I recall we need to amend PEP 612 right? Serhiy would you like me to try write an initial draft (and then you can review it?). |
Sure. What should be clarified: ParamSpec variables and TypeVar variables are exposed in |
Lib/test/test_typing.py
Outdated
self.assertEqual(C[int, P2], Concatenate[int, P2]) | ||
self.assertEqual(C[int, [str, float]], (int, str, float)) | ||
self.assertEqual(C[int, []], (int,)) | ||
self.assertEqual(C[int, ...], Concatenate[int, ...]) |
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.
I am not sure about this. It can be just [int, ...]
, although it would create a discrepancy with using ellipsis in Tuple.
Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.10. |
…t parameter expressions (pythonGH-27518) * Substitution with a list of types returns now a tuple of types. * Substitution with Concatenate returns now a Concatenate with concatenated lists of arguments. * Substitution with Ellipsis is not supported. (cherry picked from commit ecfacc3) Co-authored-by: Serhiy Storchaka <[email protected]>
GH-30959 is a backport of this pull request to the 3.10 branch. |
…t parameter expressions (GH-27518) * Substitution with a list of types returns now a tuple of types. * Substitution with Concatenate returns now a Concatenate with concatenated lists of arguments. * Substitution with Ellipsis is not supported. (cherry picked from commit ecfacc3) Co-authored-by: Serhiy Storchaka <[email protected]>
Should this be backported? |
This PR fixes substitution of a ParamSpec variable with a Concatenate or a list of types. It is not specified by PEP 612, but does not conflict with it. Substitution with an ellipsis is now an error, because the result cannot be expressed without changing PEP 612. I have opened #30969 for supporting ellipsis. |
…t parameter expressions
https://bugs.python.org/issue44791