Skip to content

Commit fd206b6

Browse files
[3.9] Save a reference for ensure_future and create_task (GH-29163) (GH-29573)
Co-authored-by: Joannah Nanjekye <[email protected]> (cherry picked from commit c750adb) Co-authored-by: Joannah Nanjekye <[email protected]> Automerge-Triggered-By: GH:asvetlov
1 parent a40d066 commit fd206b6

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

Doc/library/asyncio-future.rst

+3
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ Future Functions
5454
See also the :func:`create_task` function which is the
5555
preferred way for creating new Tasks.
5656

57+
Save a reference to the result of this function, to avoid
58+
a task disappearing mid execution.
59+
5760
.. versionchanged:: 3.5.1
5861
The function accepts any :term:`awaitable` object.
5962

Doc/library/asyncio-task.rst

+5
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,11 @@ Creating Tasks
274274
task = asyncio.ensure_future(coro())
275275
...
276276

277+
.. important::
278+
279+
Save a reference to the result of this function, to avoid
280+
a task disappearing mid execution.
281+
277282
.. versionadded:: 3.7
278283

279284
.. versionchanged:: 3.8

0 commit comments

Comments
 (0)