Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.7k
gh-102615: Fix type vars substitution ofcollections.abc.Callable and custom generics withParamSpec#102681
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
…ble` and custom generics with `ParamSpec`
Uh oh!
There was an error while loading.Please reload this page.
Fidget-Spinner commentedMar 14, 2023 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
I encountered another bug, the EDIT: THIS MIGHT NOT BE A BUG, AS ITS AN INVALID USE. PLEASE IGNORE THIS@sobolevn |
sobolevn commentedMar 14, 2023 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
@Fidget-Spinner I would like to move all I've only touched params substitution here. |
sobolevn commentedMar 14, 2023 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Wait a moment, this is not about >>>ca.Callable[[int,P],int][P].__args__(<class'int'>,~P,<class'int'>)>>>ca.Callable[[int,P],int][P][int].__args__(<class'int'>, (<class'int'>,),<class'int'>) |
sobolevn commentedMar 14, 2023 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Funny thing, I just removed this code from if (len(self.__parameters__)==1and_is_param_expr(self.__parameters__[0])anditemandnot_is_param_expr(item[0])):item= (item,) All tests still pass :) 🤯 |
AlexWaygood left a comment• edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
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 the runtime is correct in raising TypeError for these situations, actually: see#102615 (comment)
Maybe instead, we should focus on improving the error message, so that users get more specific feedback on why the substitution is being disallowed? Though if it adds too much complexity to the code, I probably wouldn't bother with it.
sobolevn commentedMar 14, 2023
I am going to close this for now, I will add new tests in other PRs, because this one has a big unrelated history. |
Uh oh!
There was an error while loading.Please reload this page.
I would prefer to create two PRs tofix#102615
Callableand custom generics withParamSpeclistinstead oftupleinreprof paramspec #102637 to change therepr