diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2021-11-16 11:51:19 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-16 11:51:19 (GMT) |
commit | 7bac59881969f6054fee12d4e3343b7fa1c43136 (patch) | |
tree | 1e6a401849b317df61ab6a2c63592a6a0f1692b7 /Doc | |
parent | 7c99e434a9b3830698d52a62fe8641d480856ca9 (diff) | |
download | cpython-7bac59881969f6054fee12d4e3343b7fa1c43136.zip cpython-7bac59881969f6054fee12d4e3343b7fa1c43136.tar.gz cpython-7bac59881969f6054fee12d4e3343b7fa1c43136.tar.bz2 |
Save a reference for ensure_future and create_task (GH-29163)
Co-authored-by: Joannah Nanjekye <jnanjekye@python.org>
(cherry picked from commit c750adbe6990ee8239b27d5f4591283a06bfe862)
Co-authored-by: Joannah Nanjekye <33177550+nanjekyejoannah@users.noreply.github.com>
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/asyncio-future.rst | 3 | ||||
-rw-r--r-- | Doc/library/asyncio-task.rst | 5 |
2 files changed, 8 insertions, 0 deletions
diff --git a/Doc/library/asyncio-future.rst b/Doc/library/asyncio-future.rst index ef496a2..3496387 100644 --- a/Doc/library/asyncio-future.rst +++ b/Doc/library/asyncio-future.rst @@ -54,6 +54,9 @@ Future Functions 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. + .. versionchanged:: 3.5.1 The function accepts any :term:`awaitable` object. diff --git a/Doc/library/asyncio-task.rst b/Doc/library/asyncio-task.rst index fb86892..f18b0e3 100644 --- a/Doc/library/asyncio-task.rst +++ b/Doc/library/asyncio-task.rst @@ -274,6 +274,11 @@ Creating Tasks task = asyncio.ensure_future(coro()) ... + .. important:: + + Save a reference to the result of this function, to avoid + a task disappearing mid execution. + .. versionadded:: 3.7 .. versionchanged:: 3.8 |