New submission from jack1142 <kuba.kuc...@gmail.com>:
asyncio REPL doesn't allow using asynchronous comprehensions outside of async func. Same behavior can also be observed when using `ast.PyCF_ALLOW_TOP_LEVEL_AWAIT` flag in `compile()` Example with `async for`: >>> async def async_gen(): ... for x in range(5): ... yield await asyncio.sleep(1, x) ... >>> [x async for x in async_gen()] File "<console>", line 0 SyntaxError: asynchronous comprehension outside of an asynchronous function Example with `await`: >>> [await asyncio.sleep(1, x) for x in range(5)] File "<console>", line 0 SyntaxError: asynchronous comprehension outside of an asynchronous function ---------- components: asyncio messages: 361443 nosy: asvetlov, jack1142, yselivanov priority: normal severity: normal status: open title: Asynchronous comprehensions don't work in asyncio REPL type: behavior versions: Python 3.8, Python 3.9 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue39562> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com