mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Save a reference for ensure_future and create_task (GH-29163)
Co-authored-by: Joannah Nanjekye <jnanjekye@python.org>
This commit is contained in:
parent
6c5a312fb6
commit
c750adbe69
2 changed files with 8 additions and 0 deletions
|
@ -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.
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue