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-104770: Let generator.close() return value#104771
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
bedevere-bot commentedMay 22, 2023
Most changes to Pythonrequire a NEWS entry. Please add it using theblurb_it web app or theblurb command-line tool. |
ghost commentedMay 22, 2023 • edited by ghost
Loading Uh oh!
There was an error while loading.Please reload this page.
edited by ghost
Uh oh!
There was an error while loading.Please reload this page.
bedevere-bot commentedMay 22, 2023
Most changes to Pythonrequire a NEWS entry. Please add it using theblurb_it web app or theblurb command-line tool. |
gvanrossum 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.
I'm also asking@iritkatriel to review -- I'm not sure if poking attstate->current_exception is the right way to access the current exception. Maybe the brand newPyPyErr_GetRaisedException() is the API to use? (Then you don't even need to get the tstate).
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
bedevere-bot commentedMay 23, 2023
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
ntessore commentedMay 23, 2023
I have made the requested changes; please review again. In the docs, I made the wording of the "returns return value" situation sound as natural as I could, but it might need more polishing. I didn't know about |
bedevere-bot commentedMay 23, 2023
Thanks for making the requested changes! @gvanrossum: please review the changes made to this pull request. |
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
bedevere-bot commentedMay 23, 2023
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
Uh oh!
There was an error while loading.Please reload this page.
ntessore commentedMay 23, 2023
Thanks@iritkatriel, that is much better. I have made the requested changes; please review again. |
bedevere-bot commentedMay 23, 2023
Thanks for making the requested changes! @gvanrossum,@iritkatriel: please review the changes made to this pull request. |
Uh oh!
There was an error while loading.Please reload this page.
gvanrossum commentedMay 23, 2023
I'll leave the rest of the review to Irit. |
iritkatriel 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.
Code looks fine, a couple of comments on documentation.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Misc/NEWS.d/next/Core and Builtins/2023-05-23-00-36-02.gh-issue-104770.poSkyY.rst OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
gvanrossum 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.
Fantastic! I will merge now.
ntessore commentedMay 23, 2023
Thanks again Irit and Guido for your help and patience! |
Uh oh!
There was an error while loading.Please reload this page.
This changeset alters
generator.close()to return the value of aStopIterationit encounters. Conceptually, the change is simple: instead of lumpingStopIterationin withGeneratorExitand ignoring it, the exception is handled specially and its value returned.Practically, handling the exception is a little awkward because no high-level API exists (afaict) to retrieve the value of a
StopIteration. I would be happy for any pointers on how to handle this better, if possible.📚 Documentation preview 📚:https://cpython-previews--104771.org.readthedocs.build/