From 00cf5eacc52d4790c23a24c835fb6b048cb27d8c Mon Sep 17 00:00:00 2001 From: Case Zumbrum <51789445+CaseZumbrum@users.noreply.github.com> Date: Sun, 13 Apr 2025 03:59:22 -0400 Subject: [PATCH] gh-129169: update `asyncio.ensure_future` docs to suggest taskgroups Co-authored-by: Kumar Aditya --- Doc/library/asyncio-future.rst | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Doc/library/asyncio-future.rst b/Doc/library/asyncio-future.rst index 9dce07314119..32771ba72e00 100644 --- a/Doc/library/asyncio-future.rst +++ b/Doc/library/asyncio-future.rst @@ -51,12 +51,13 @@ Future Functions .. important:: - See also the :func:`create_task` function which is the - preferred way for creating new Tasks. - Save a reference to the result of this function, to avoid a task disappearing mid-execution. + See also the :func:`create_task` function which is the + preferred way for creating new tasks or use :class:`asyncio.TaskGroup` + which keeps reference to the task internally. + .. versionchanged:: 3.5.1 The function accepts any :term:`awaitable` object.