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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-97696 Add documentation for get_coro() behavior with eager tasks #104304

Merged
merged 6 commits into from
May 9, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 11 additions & 0 deletions Doc/library/asyncio-task.rst
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,8 @@
and there is no running event loop.


.. _eager-task-factory:

Eager Task Factory
==================

Expand Down Expand Up @@ -829,16 +831,16 @@
| Constant | Description |
+=============================+========================================+
| :const:`FIRST_COMPLETED` | The function will return when any |
| | future finishes or is cancelled. |

Check warning on line 834 in Doc/library/asyncio-task.rst

View workflow job for this annotation

GitHub Actions / Docs

py:const reference target not found: FIRST_COMPLETED
+-----------------------------+----------------------------------------+
| :const:`FIRST_EXCEPTION` | The function will return when any |
| | future finishes by raising an |

Check warning on line 837 in Doc/library/asyncio-task.rst

View workflow job for this annotation

GitHub Actions / Docs

py:const reference target not found: FIRST_EXCEPTION

Check warning on line 837 in Doc/library/asyncio-task.rst

View workflow job for this annotation

GitHub Actions / Docs

py:const reference target not found: ALL_COMPLETED
| | exception. If no future raises an |
| | exception then it is equivalent to |
| | :const:`ALL_COMPLETED`. |
+-----------------------------+----------------------------------------+
| :const:`ALL_COMPLETED` | The function will return when all |
| | futures finish or are cancelled. |

Check warning on line 843 in Doc/library/asyncio-task.rst

View workflow job for this annotation

GitHub Actions / Docs

py:const reference target not found: ALL_COMPLETED
+-----------------------------+----------------------------------------+

Unlike :func:`~asyncio.wait_for`, ``wait()`` does not cancel the
Expand Down Expand Up @@ -1174,8 +1176,17 @@

Return the coroutine object wrapped by the :class:`Task`.

.. note::

This will return ``None`` for Tasks which have already
completed eagerly. See the :ref:`Eager Task Factory <eager-task-factory>`.

.. versionadded:: 3.8

.. versionchanged:: 3.12

Newly added eager task execution means result may be ``None``.

.. method:: get_context()

Return the :class:`contextvars.Context` object
Expand Down