bpo-33649: Fix gather() docs; fix title; few other nits. (GH-9475) · python/cpython@db1a80e
@@ -129,7 +129,8 @@ other coroutines::
129129130130 async def main():
131131 # Nothing happens if we just call "nested()".
132- # (a coroutine object is created but not awaited)
132+ # A coroutine object is created but not awaited,
133+ # so it *won't run at all*.
133134 nested()
134135135136 # Let's do it differently now and await it:
@@ -313,12 +314,15 @@ Running Tasks Concurrently
313314 aggregate list of returned values. The order of result values
314315 corresponds to the order of awaitables in *aws*.
315316317+ If *return_exceptions* is ``False`` (default), the first
318+ raised exception is immediately propagated to the task that
319+ awaits on ``gather()``. Other awaitables in the *aws* sequence
320+ **won't be cancelled** and will continue to run.
321+316322 If *return_exceptions* is ``True``, exceptions are treated the
317323 same as successful results, and aggregated in the result list.
318- Otherwise, the first raised exception is immediately propagated
319- to the task that awaits on ``gather()``.
320324321- If ``gather`` is *cancelled*, all submitted awaitables
325+ If ``gather()`` is *cancelled*, all submitted awaitables
322326 (that have not completed yet) are also *cancelled*.
323327324328 If any Task or Future from the *aws* sequence is *cancelled*, it is
@@ -368,16 +372,15 @@ Running Tasks Concurrently
368372 propagated regardless of *return_exceptions*.
369373370374371-Shielding Tasks From Cancellation
372-=================================
375+Shielding From Cancellation
376+===========================
373377374378.. awaitablefunction:: shield(aw, \*, loop=None)
375379376380 Protect an :ref:`awaitable object <asyncio-awaitables>`
377381 from being :meth:`cancelled <Task.cancel>`.
378382379- *aw* can be a coroutine, a Task, or a Future-like object. If
380- *aw* is a coroutine it is automatically scheduled as a Task.
383+ If *aw* is a coroutine it is automatically scheduled as a Task.
381384382385 The statement::
383386@@ -609,7 +612,7 @@ Task Object
609612610613.. class:: Task(coro, \*, loop=None, name=None)
611614612- A :class:`Future`-like object that wraps a Python
615+ A :class:`Future-like <Future>` object that runs a Python
613616:ref:`coroutine <coroutine>`. Not thread-safe.
614617615618 Tasks are used to run coroutines in event loops.
@@ -831,7 +834,7 @@ Task Object
831834 is used to get the current loop.
832835833836 This method is **deprecated** and will be removed in
834- Python 3.9. Use the :func:`all_tasks` function instead.
837+ Python 3.9. Use the :func:`asyncio.all_tasks` function instead.
835838836839 .. classmethod:: current_task(loop=None)
837840@@ -841,7 +844,8 @@ Task Object
841844 is used to get the current loop.
842845843846 This method is **deprecated** and will be removed in
844- Python 3.9. Use the :func:`current_task` function instead.
847+ Python 3.9. Use the :func:`asyncio.current_task` function
848+ instead.
845849846850847851.. _asyncio_generator_based_coro: