This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author yselivanov
Recipients asvetlov, gvanrossum, lukasz.langa, ncoghlan, njs, yselivanov
Date 2019-10-22.22:09:37
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1571782177.3.0.18136069129.issue38559@roundup.psfhosted.org>
In-reply-to
Content
Just discussed this issue off-list with Nathaniel.  Maybe this isn't as severe as I thought it is.

If we cancel all asyncio tasks before calling `loop.shutdown_asyncgens()` this *probably* becomes a non-issue.  And "asyncio.run()" does just that [1].

Any asynchronous generator ultimately needs a task to iterate it, so if we cancel tasks, we should cancel all asynchronous generators too.  Calling `loop.shutdown_asyncgens()` then ensures that there are no orphan async generators.  The only way (at least known to me) that that could be the case if some tasks ignores cancellation.  

Nathaniel, what do you think about this in the context of Trio?

If anything, we can update asyncio docs explaining the new behavior of async generators and how to use "loop.shutdown_asyncgens()".

[1] https://github.com/python/cpython/blob/91528f40c30717563a478920861c81d18da5bf63/Lib/asyncio/runners.py#L46
History
Date User Action Args
2019-10-22 22:09:37yselivanovsetrecipients: + yselivanov, gvanrossum, ncoghlan, njs, asvetlov, lukasz.langa
2019-10-22 22:09:37yselivanovsetmessageid: <1571782177.3.0.18136069129.issue38559@roundup.psfhosted.org>
2019-10-22 22:09:37yselivanovlinkissue38559 messages
2019-10-22 22:09:37yselivanovcreate