GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||
GeezerVison is showing github.com — bpo-41559: Implement PEP 612 - Add ParamSpec and Concatenate to typing by Fidget-Spinner · Pull Request #23702 · python/cpython Conversation
|
|
Points taken. Sorry D'oh, I just realised I answered my own question since we need |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Co-Authored-By: Guido van Rossum <[email protected]>
also reduced runtime checks
|
Let's wait until #23060 has landed and then see what adjustments this might need. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Finally looking at this...
Yeah, ParamSpec is super special, and you can't do anything with it that isn't explicitly mentioned in the PEP. So it's debatable whether So let's not worry about those clearly wrong cases. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
Sorry, submitted too soon. (UPDATE: Not, I made a mistake -- or GitHub did. :-) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Excellent work! Thanks for your perseverance. My feedback is mostly simple improvements.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
| } | ||
| // convert all the lists inside args to tuples to help | ||
| // with caching in other libaries if substituting a ParamSpec | ||
| if (PyList_CheckExact(subst) && is_paramspec(arg)) { |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Why only do this for ParamSpec?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I'm afraid of existing code relying on substituting typevars in genericalias with lists, then expecting that list to be inside __args__. Although in Python 3.9 that should be invalid, and the IDE/type checker should warn the users about that already.
If I just convert list to tuples for all cases, the C code will become way simpler :).
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
There can't be much code yet relying about anything for GenericAlias -- it's new in 3.9. We could backport that particular behavior to 3.9.3 to ensure there won't be any more code relying on it. :-)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Co-Authored-By: Guido van Rossum <[email protected]>
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Re: the 3.9 issues that you discovered: maybe create a PR for those first, land that in master and 3.9 branch, then merge master into this PR?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
Guido, thank you so much for all the time you've put into reviewing this PR! I learnt quite a bit about the typing module in the process :).
Yeah I agree, I created #23915 for that. Once that one lands, I'll merge the changes in along with some of your suggestions. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
I think it’s ready! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@Fidget-Spinner Let me know if you agree. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Yes! Sorry, I thought you were going to merge it in so I was waiting too 😆 . |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I figured that was the case. :-) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@gvanrossum: Please replace |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@gvanrossum Oh dang I knew I had a hunch I missed something :/. I forgot to convert all lists to tuples in ga_new/setup_ga too (I did it only for getitem and co.). Well on the bright side, having that as a separate PR makes backporting to 3.9 easier if anything :), and anyways lists aren't valid in genericalias other than the Callable case (which we already have covered), so we won't have anything broken even without that in right now. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I'll fix that some other time, right now I'm celebrating 🥳 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.