Skip to content
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

StopIteration passtrough not handled correctly #544

Closed
RonnyPfannschmidt opened this issue Oct 31, 2024 · 0 comments · Fixed by #545
Closed

StopIteration passtrough not handled correctly #544

RonnyPfannschmidt opened this issue Oct 31, 2024 · 0 comments · Fixed by #545
Assignees
Labels

Comments

@RonnyPfannschmidt
Copy link
Member

cpython impl ref in contextmanager

a test in one of my testsuites failed with a StopIteration as exception

this ran into issues as new style hook wrappers dont manage the RuntimeError of stopIteration

>>> def mygen(): yield
... 
>>> gen = mygen()
>>> next(gen)
>>> e = StopIteration()
>>> try:
...   gen.throw(e)
... except Exception as err:
...   runtime = err
... 
>>> runtime
RuntimeError('generator raised StopIteration')
>>> runtime.
runtime.add_note(        runtime.args             runtime.with_traceback(  
>>> runtime.a
runtime.add_note(  runtime.args       
>>> runtime.args
('generator raised StopIteration',)
>>> runtime.__cause__
StopIteration()
>>> runtime.__cause__ is e
True
>>> 
@RonnyPfannschmidt RonnyPfannschmidt self-assigned this Oct 31, 2024
RonnyPfannschmidt added a commit to RonnyPfannschmidt/pluggy that referenced this issue Oct 31, 2024
Raising a StopIteration in a generator triggers a RuntimeError.
If the RuntimeError of a generator has the passed in StopIteration as cause
resume with that StopIteration as normal exception instead of failing with the RuntimeError.
RonnyPfannschmidt added a commit to RonnyPfannschmidt/pluggy that referenced this issue Oct 31, 2024
Raising a StopIteration in a generator triggers a RuntimeError.
If the RuntimeError of a generator has the passed in StopIteration as cause
resume with that StopIteration as normal exception instead of failing with the RuntimeError.
RonnyPfannschmidt added a commit to RonnyPfannschmidt/pluggy that referenced this issue Nov 3, 2024
Raising a StopIteration in a generator triggers a RuntimeError.
If the RuntimeError of a generator has the passed in StopIteration as cause
resume with that StopIteration as normal exception instead of failing with the RuntimeError.
RonnyPfannschmidt added a commit to RonnyPfannschmidt/pluggy that referenced this issue Nov 3, 2024
Raising a StopIteration in a generator triggers a RuntimeError.
If the RuntimeError of a generator has the passed in StopIteration as cause
resume with that StopIteration as normal exception instead of failing with the RuntimeError.
RonnyPfannschmidt added a commit that referenced this issue Nov 12, 2024
…stop-iteration-passtrough

fix #544: Correctly pass StopIteration trough wrappers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant