gh-128078: Clear exception in anext before calling _PyGen_SetStopIterationValue#128780
Conversation
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
I have checked them and they all satisfy |
|
Thanks @picnixz for the PR, and @kumaraditya303 for merging it 🌮🎉.. I'm working now to backport this PR to: 3.12. |
|
Thanks @picnixz for the PR, and @kumaraditya303 for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13. |
…tStopIterationValue` (pythonGH-128780) (cherry picked from commit 76ffaef) Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com> Co-authored-by: Kumar Aditya <kumaraditya@python.org>
|
GH-128784 is a backport of this pull request to the 3.12 branch. |
…tStopIterationValue` (pythonGH-128780) (cherry picked from commit 76ffaef) Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com> Co-authored-by: Kumar Aditya <kumaraditya@python.org>
|
GH-128785 is a backport of this pull request to the 3.13 branch. |
…etStopIterationValue` (GH-128780) (#128784) gh-128078: Clear exception in `anext` before calling `_PyGen_SetStopIterationValue` (GH-128780) (cherry picked from commit 76ffaef) Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com> Co-authored-by: Kumar Aditya <kumaraditya@python.org>
…etStopIterationValue` (GH-128780) (#128785) gh-128078: Clear exception in `anext` before calling `_PyGen_SetStopIterationValue` (GH-128780) (cherry picked from commit 76ffaef) Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com> Co-authored-by: Kumar Aditya <kumaraditya@python.org>
See #128078 (comment).
@kumaraditya303: There are a couple of other calls to
_PyGen_SetStopIterationValue()but I'm not well-versed enough in asyncio to know whether I should clear them or not. The regression test now passes but please confirm whether some otherPyErr_Clear()should happen or not.In
async_gen_unwrap_value:In
gen_iternext:In this case, I think we should satisfy
assert(!PyErr_Occurred())since it'sPYGEN_RETURN, right? Same question forgen_send_exandFutureIter_iternext().