New submission from Valentin Lavrinenko <valentin.lavrine...@gmail.com>:

```
@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 <rep...@bugs.python.org>
<https://bugs.python.org/issue33786>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to