Skip to content

StopIteration passtrough not handled correctly #544

@RonnyPfannschmidt

Description

@RonnyPfannschmidt

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
>>> 

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions