Skip to content

Commit

Permalink
Save a reference for ensure_future and create_task (pythonGH-29163)
Browse files Browse the repository at this point in the history
Co-authored-by: Joannah Nanjekye <jnanjekye@python.org>
  • Loading branch information
2 people authored and remykarem committed Dec 7, 2021
1 parent 258ec73 commit 1a73eaa
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Doc/library/asyncio-future.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
5 changes: 5 additions & 0 deletions Doc/library/asyncio-task.rst
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,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
Expand Down

0 comments on commit 1a73eaa

Please sign in to comment.