Message361443
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 |
|
Date |
User |
Action |
Args |
2020-02-05 17:28:25 | jack1142 | set | recipients:
+ jack1142, asvetlov, yselivanov |
2020-02-05 17:28:25 | jack1142 | set | messageid: <1580923705.71.0.29233909242.issue39562@roundup.psfhosted.org> |
2020-02-05 17:28:25 | jack1142 | link | issue39562 messages |
2020-02-05 17:28:25 | jack1142 | create | |
|