-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
gh-88965: Fix type substitution of a list of types after initial ParamSpec
substitution
#102808
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
Conversation
…l `ParamSpec` substitution
@AlexWaygood you might be interested, since you've originally asked to take a look :) |
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 think this is the correct solution -- thanks so much for taking a look at this! I have a couple of points about code readability, and a suggestion about the tests:
@AlexWaygood friendly ping :) |
I haven't forgotten! It's only been two days 😄 |
Oh wow, the time is a very strange thing! |
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.
Looks great to me. I have some ideas about how to clean up the tuple
special-casing, but I think that should wait for another PR, as it might not be so backportable.
Misc/NEWS.d/next/Library/2023-03-18-14-59-21.gh-issue-88965.kA70Km.rst
Outdated
Show resolved
Hide resolved
Thanks @sobolevn for the PR, and @AlexWaygood for merging it 🌮🎉.. I'm working now to backport this PR to: 3.10, 3.11. |
Sorry @sobolevn and @AlexWaygood, I had trouble checking out the |
Sorry, @sobolevn and @AlexWaygood, I could not cleanly backport this to |
Thanks @sobolevn for the PR, and @AlexWaygood for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11. |
Sorry @sobolevn and @AlexWaygood, I had trouble checking out the |
Thanks @sobolevn for the PR, and @AlexWaygood for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11. |
…r initial `ParamSpec` substitution (pythonGH-102808) Previously, this used to fail: ```py from typing import * T = TypeVar("T") P = ParamSpec("P") class X(Generic[P]): f: Callable[P, int] Y = X[[int, T]] Z = Y[str] ``` (cherry picked from commit adb0621) Co-authored-by: Nikita Sobolev <mail@sobolevn.me> Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
GH-102957 is a backport of this pull request to the 3.11 branch. |
I think backporting this might be quite complex, due to the fact that If you'd like to give it a stab @sobolevn, I'll happily review a backport PR -- but I'm also happy to just leave it unfixed on 3.10. |
Let’s leave 3.10 alone. |
Ok, I won't bother then. Thanks everyone! 👍 |
…ial `ParamSpec` substitution (GH-102808) Previously, this used to fail: ```py from typing import * T = TypeVar("T") P = ParamSpec("P") class X(Generic[P]): f: Callable[P, int] Y = X[[int, T]] Z = Y[str] ``` (cherry picked from commit adb0621) Co-authored-by: Nikita Sobolev <mail@sobolevn.me> Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
@AlexWaygood btw, do you have any ideas of issues I can work on? I am out of my backlog :( |
I have one in the back of my head that I'll try to write up today ;) |
…r initial `ParamSpec` substitution (python#102808) Previously, this used to fail: ```py from typing import * T = TypeVar("T") P = ParamSpec("P") class X(Generic[P]): f: Callable[P, int] Y = X[[int, T]] Z = Y[str] ``` Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
…r initial `ParamSpec` substitution (python#102808) Previously, this used to fail: ```py from typing import * T = TypeVar("T") P = ParamSpec("P") class X(Generic[P]): f: Callable[P, int] Y = X[[int, T]] Z = Y[str] ``` Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
I've tried to make tests as complete as I can imagine. But, extra cases and suggestions are welcome! ;)
This change has two parts: