Message396650
Inlined asyncio.run(func()) is roughly equivalent to the following code:
loop = asyncio.new_event_loop()
loop.run_until_complete(func())
loop.run_until_complete(loop.shutdown_asyncgens())
loop.close()
If comment out loop.run_until_complete(loop.shutdown_asyncgens()) I get the following output:
finalize outer
Task was destroyed but it is pending!
task: <Task pending name='Task-2' coro=<<async_generator_athrow without __name__>()>>
END
No "finalize inner" but a warning about pending task instead.
On other hand, the following code
for _ in func().__await__(): pass
produces the output in expected order:
finalize inner
finalize outer
END |
|
Date |
User |
Action |
Args |
2021-06-28 16:40:46 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka, gvanrossum, asvetlov, Mark.Shannon, yselivanov, Guido.van.Rossum |
2021-06-28 16:40:46 | serhiy.storchaka | set | messageid: <1624898446.12.0.686803311056.issue44518@roundup.psfhosted.org> |
2021-06-28 16:40:46 | serhiy.storchaka | link | issue44518 messages |
2021-06-28 16:40:46 | serhiy.storchaka | create | |
|