Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-44665: asyncio.create_task() documentation should mention user needs to keep reference to the task #29163

Merged
merged 1 commit into from
Nov 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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