[issue1462485] StopIteration raised in body of 'with' statement suppressed

Thomas Grainger report at bugs.python.org
Mon Jul 5 05:42:53 EDT 2021


Thomas Grainger <tagrain at gmail.com> added the comment:

```
import contextlib

@contextlib.contextmanager
def foo():
    yield

class StartIrritation(StopIteration):
    pass


with foo():
    raise StartIrritation
```

----------
nosy: +graingert

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue1462485>
_______________________________________


More information about the Python-bugs-list mailing list