[issue37172] Odd error awating a Future

2019-06-06 Thread Andrew Svetlov
Andrew Svetlov added the comment: Global future objects (and global asyncio objects in general) don't work with asyncio.run(). The lifecycle of these objects should be closer than loop but asyncio.run() creates a loop during execution. I think this is a good design, we have a plan to depreca

[issue37172] Odd error awating a Future

2019-06-06 Thread Dima Tisnek
New submission from Dima Tisnek : Let's start with correct code: import asyncio async def writer(): await asyncio.sleep(1) g1.set_result(41) async def reader(): await g1 async def test(): global g1 g1 = asyncio.Future() await asyncio.gather(reader(), writer()) asyn