-
-
Notifications
You must be signed in to change notification settings - Fork 33.2k
gh-128078: Simplify logic in _PyGen_SetStopIterationValue (follow-up to gh-128780)
#128287
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
gh-128078: Simplify logic in _PyGen_SetStopIterationValue (follow-up to gh-128780)
#128287
Conversation
StopIteration-like exceptions in _PyGen_SetStopIterationValueStopAsyncIteration in _PyGen_SetStopIterationValue
|
Instead of adding another special case, how about removing the special case for tuples? Maybe use |
|
@markshannon Is this something like that you had in mind? |
StopAsyncIteration in _PyGen_SetStopIterationValue_PyGen_SetStopIterationValue (follow-up to gh-128780)
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
|
Thanks @picnixz for the PR, and @kumaraditya303 for merging it 🌮🎉.. I'm working now to backport this PR to: 3.12, 3.13. |
…rationValue` (pythonGH-128287) (cherry picked from commit 402b91d) Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com> Co-authored-by: Kumar Aditya <kumaraditya@python.org>
|
GH-128789 is a backport of this pull request to the 3.13 branch. |
…rationValue` (pythonGH-128287) (cherry picked from commit 402b91d) Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com> Co-authored-by: Kumar Aditya <kumaraditya@python.org>
|
GH-128790 is a backport of this pull request to the 3.12 branch. |
Some calls have aStopAsyncIterationexception set at this point but we should ignore them since this function is meant to create aStopIterationinstead (or replace an existingStopAsyncIteration)Alternative I have also envisaged:
- Unconditionally clear an optional caller's exception: this would be probably fine but this could hide bugs.- Also clearStopIteration: strictly speaking I think we could also do it but as I'm not extremely familiar with the call graph, I'd prefer restricting it toStopAsyncIterationfor now.Following #128780, no need for checking whether an exception is set or not as no exception should be set at all. So we can simplify the logic.