Skip to content

Commit c6bc883

Browse files
miss-islingtonsobolevnStanFromIrelandhugovkasvetlov
authored
[3.14] gh-151950: Document asyncio.BaseEventLoop and fix asyncio-extending.rst (GH-151976) (#160868)
Co-authored-by: sobolevn <[email protected]> Co-authored-by: Stan Ulbrych <[email protected]> Co-authored-by: Hugo van Kemenade <[email protected]> Co-authored-by: Andrew Svetlov <[email protected]>
1 parent b849647 commit c6bc883

3 files changed

Lines changed: 18 additions & 5 deletions

File tree

‎Doc/library/asyncio-eventloop.rst‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1967,6 +1967,17 @@ By default asyncio is configured to use :class:`EventLoop`.
19671967
methods that an alternative implementation of ``AbstractEventLoop``
19681968
should have defined.
19691969

1970+
.. class:: BaseEventLoop
1971+
1972+
A base class that partially implements :class:`AbstractEventLoop`
1973+
to simplify writing custom event loops.
1974+
1975+
It provides default implementations of many :class:`AbstractEventLoop`
1976+
methods, so subclasses have fewer methods to implement themselves.
1977+
In return, a subclass is expected to implement a number of internal,
1978+
protected methods.
1979+
See :ref:`writing_custom_event_loop` for more information.
1980+
19701981

19711982
Examples
19721983
========

‎Doc/library/asyncio-extending.rst‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,17 @@ classes. Asyncio has helpers that could be used to simplify this task.
1212

1313
Third-parties should reuse existing asyncio code with caution,
1414
a new Python version is free to break backward compatibility
15-
in *internal* part of API.
15+
in the *internal* part of the API.
1616

1717

18-
Writing a Custom Event Loop
18+
.. _writing_custom_event_loop:
19+
20+
Writing a custom event loop
1921
===========================
2022

21-
:class:`asyncio.AbstractEventLoop` declares very many methods. Implementing all them
22-
from scratch is a tedious job.
23+
:class:`asyncio.AbstractEventLoop` declares very many methods.
24+
See :ref:`asyncio-event-loop-methods` for the full list.
25+
Implementing them all from scratch is a tedious job.
2326

2427
A loop can get many common methods implementation for free by inheriting from
2528
:class:`asyncio.BaseEventLoop`.

‎Doc/tools/.nitignore‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
Doc/c-api/module.rst
66
Doc/library/ast.rst
7-
Doc/library/asyncio-extending.rst
87
Doc/library/logging.config.rst
98
Doc/library/logging.handlers.rst
109
Doc/library/multiprocessing.rst

0 commit comments

Comments
 (0)