New submission from Valentin Lavrinenko <[email protected]>:
```
@asynccontextmanager
async def ctx():
yield
async def gen():
async with ctx():
yield 'hello'
yield 'world'
async def main():
async with ctx():
async for value in gen():
print(value)
raise RuntimeError()
```
Running main() leads to `RuntimeError: generator didn't stop after throw()`.
This happens because async gernerator's `.athrow()` method doesn't re-throw
`GeneratorExit` exception; probably, this is wrong.
----------
components: asyncio
messages: 318853
nosy: Valentin Lavrinenko, asvetlov, yselivanov
priority: normal
severity: normal
status: open
title: @asynccontextmanager doesn't work well with async generators
versions: Python 3.7
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue33786>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com