]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-96377: Update asyncio policy doc intro paras to be clear and accurate (GH-97603)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Wed, 28 Sep 2022 00:33:32 +0000 (17:33 -0700)
committerPablo Galindo <pablogsal@gmail.com>
Sat, 22 Oct 2022 19:05:58 +0000 (20:05 +0100)
Also fix up some cross-references in the asyncio docs.
(cherry picked from commit cc0f3a10f0ee507d9044ef9036cf3e711c5338a9)

Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
Doc/library/asyncio-dev.rst
Doc/library/asyncio-eventloop.rst
Doc/library/asyncio-llapi-index.rst
Doc/library/asyncio-policy.rst

index 29d69b9f748d46f1671f822349561c2896c1806d..921a394a59fec7ccd0af5cf94be41f60f1591106 100644 (file)
@@ -109,7 +109,7 @@ that the event loop runs in.
 
 There is currently no way to schedule coroutines or callbacks directly
 from a different process (such as one started with
-:mod:`multiprocessing`). The :ref:`Event Loop Methods <asyncio-event-loop>`
+:mod:`multiprocessing`). The :ref:`asyncio-event-loop-methods`
 section lists APIs that can read from pipes and watch file descriptors
 without blocking the event loop. In addition, asyncio's
 :ref:`Subprocess <asyncio-subprocess>` APIs provide a way to start a
index 41ebc0447dca79b43f236e973a9b071f9bcf828d..15f4f04fbe9ac3950e0fb6e5ce041f3b4ec67421 100644 (file)
@@ -1,6 +1,8 @@
 .. currentmodule:: asyncio
 
 
+.. _asyncio-event-loop:
+
 ==========
 Event Loop
 ==========
@@ -92,7 +94,7 @@ This documentation page contains the following sections:
   loop APIs.
 
 
-.. _asyncio-event-loop:
+.. _asyncio-event-loop-methods:
 
 Event Loop Methods
 ==================
@@ -1616,6 +1618,7 @@ Do not instantiate the class directly.
 
 
 .. _asyncio-event-loops:
+.. _asyncio-event-loop-implementations:
 
 Event Loop Implementations
 ==========================
@@ -1665,7 +1668,7 @@ on Unix and :class:`ProactorEventLoop` on Windows.
 
    Abstract base class for asyncio-compliant event loops.
 
-   The :ref:`Event Loop Methods <asyncio-event-loop>` section lists all
+   The :ref:`asyncio-event-loop-methods` section lists all
    methods that an alternative implementation of ``AbstractEventLoop``
    should have defined.
 
index cdadb7975ad4941a7271b5b6d95560436827e245..c787cb930d478171123c9a39616392a71b067b5a 100644 (file)
@@ -37,7 +37,7 @@ Event Loop Methods
 ==================
 
 See also the main documentation section about the
-:ref:`event loop methods <asyncio-event-loop>`.
+:ref:`asyncio-event-loop-methods`.
 
 .. rubric:: Lifecycle
 .. list-table::
index d528db72fb827173cd51a7b6be36a0537c99a9fb..a73e99510f0b4eb13b0fedc36fdb9c38491122e6 100644 (file)
@@ -7,7 +7,7 @@
 Policies
 ========
 
-An event loop policy is a global object
+An event loop policy is a global (per-interpreter) object
 used to get and set the current :ref:`event loop <asyncio-event-loop>`,
 as well as create new event loops.
 The default policy can be :ref:`replaced <asyncio-policy-get-set>` with
@@ -16,18 +16,20 @@ to use different event loop implementations,
 or substituted by a :ref:`custom policy <asyncio-custom-policies>`
 that can override these behaviors.
 
-A policy defines the notion of *context* and manages a
-separate event loop per context. The default policy
-defines *context* to be the current thread.
+The :ref:`policy object <asyncio-policy-objects>`
+gets and sets a separate event loop per *context*.
+This is per-thread by default,
+though custom policies could define *context* differently.
 
-By using a custom event loop policy, the behavior of
-:func:`get_event_loop`, :func:`set_event_loop`, and
-:func:`new_event_loop` functions can be customized.
+Custom event loop policies can control the behavior of
+:func:`get_event_loop`, :func:`set_event_loop`, and :func:`new_event_loop`.
 
 Policy objects should implement the APIs defined
 in the :class:`AbstractEventLoopPolicy` abstract base class.
 
 
+.. _asyncio-policy-get-set:
+
 Getting and Setting the Policy
 ==============================
 
@@ -45,6 +47,8 @@ for the current process:
    If *policy* is set to ``None``, the default policy is restored.
 
 
+.. _asyncio-policy-objects:
+
 Policy Objects
 ==============
 
@@ -91,6 +95,8 @@ The abstract event loop policy base class is defined as follows:
       This function is Unix specific.
 
 
+.. _asyncio-policy-builtin:
+
 asyncio ships with the following built-in policies:
 
 
@@ -122,6 +128,7 @@ asyncio ships with the following built-in policies:
 
    .. availability:: Windows.
 
+
 .. _asyncio-watchers:
 
 Process Watchers
@@ -275,6 +282,8 @@ implementation used by the asyncio event loop:
    .. versionadded:: 3.9
 
 
+.. _asyncio-custom-policies:
+
 Custom Policies
 ===============