Open
Description
I was expecting something like the following example to work, but it does not. This originally came up in: fastapi/fastapi#1204
from async_generator import asynccontextmanager
class GenClass:
async def __call__(self):
yield "hello"
cm = asynccontextmanager(GenClass())
with cm as value:
print(value)
The result is an exception:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/.../lib/python3.6/site-packages/async_generator/_util.py", line 100, in asynccontextmanager
"must be an async generator (native or from async_generator; "
TypeError: must be an async generator (native or from async_generator; if using @async_generator then @acontextmanager must be on top.
Metadata
Metadata
Assignees
Labels
No labels