Commit 805e27ef authored by Yury Selivanov's avatar Yury Selivanov Committed by GitHub

bpo-33649: Fix asyncio-dev (GH-9324)

parent afde1c1a
......@@ -15,7 +15,7 @@ Utilities to run asyncio programs, create Tasks, and
await on multiple things with timeouts.
.. list-table::
:widths: 30 70
:widths: 50 50
* - :func:`run`
- Create event loop, run a coroutine, close the loop.
......@@ -71,7 +71,7 @@ implement connection pools, and pub/sub patterns.
.. list-table::
:widths: 30 70
:widths: 50 50
* - :class:`Queue`
- A FIFO queue.
......@@ -97,7 +97,7 @@ Subprocesses
Utilities to spawn subprocesses and run shell commands.
.. list-table::
:widths: 30 70
:widths: 50 50
* - ``await`` :func:`create_subprocess_exec`
- Create a subprocess.
......@@ -120,7 +120,7 @@ Streams
High-level APIs to work with network IO.
.. list-table::
:widths: 30 70
:widths: 50 50
* - ``await`` :func:`open_connection`
- Establish a TCP connection.
......@@ -155,7 +155,7 @@ Synchronization
Threading-like synchronization primitives that can be used in Tasks.
.. list-table::
:widths: 30 70
:widths: 50 50
* - :class:`Lock`
- A mutex lock.
......@@ -185,7 +185,7 @@ Exceptions
==========
.. list-table::
:widths: 30 70
:widths: 50 50
* - :exc:`asyncio.TimeoutError`
......
This diff is collapsed.
......@@ -1075,6 +1075,11 @@ Enabling debug mode
Set the debug mode of the event loop.
.. versionchanged:: 3.7
The new ``-X dev`` command line option can now also be used
to enable the debug mode.
.. seealso::
The :ref:`debug mode of asyncio <asyncio-debug-mode>`.
......
......@@ -121,6 +121,16 @@ Future Object
or an exception set with :meth:`set_result` or
:meth:`set_exception` calls.
.. method:: cancelled()
Return ``True`` if the Future was *cancelled*.
The method is usually used to check if a Future is not
*cancelled* before setting a result or an exception for it::
if not fut.cancelled():
fut.set_result(42)
.. method:: add_done_callback(callback, *, context=None)
Add a callback to be run when the Future is *done*.
......@@ -180,10 +190,6 @@ Future Object
.. versionadded:: 3.7
.. method:: cancelled()
Return ``True`` if the Future was *cancelled*.
This example creates a Future object, creates and schedules an
asynchronous Task to set result for the Future, and waits until
......
......@@ -32,8 +32,9 @@ asyncio provides a set of **high-level** APIs to:
as well as **low-level** APIs for *library and framework developers* to:
* create and manage :ref:`event loops <asyncio-event-loop>`, which
provide asynchronous APIs for networking, subprocesses, OS signals,
etc;
provide asynchronous APIs for :meth:`networking <loop.create_server>`,
running :meth:`subprocesses <loop.subprocess_exec>`,
handling :meth:`OS signals <loop.add_signal_handler>`, etc;
* implement efficient protocols using
:ref:`transports <asyncio-transports-protocols>`;
......@@ -75,11 +76,3 @@ Reference
asyncio-api-index.rst
asyncio-dev.rst
.. seealso::
The :mod:`asyncio` module was proposed in :PEP:`3156`.
Since the acceptance of the PEP many new APIs were added and many
original APIs were altered. The PEP should be treated as a
historical document.
.. _ipc:
*****************************************
Interprocess Communication and Networking
Networking and Interprocess Communication
*****************************************
The modules described in this chapter provide mechanisms for different processes
to communicate.
The modules described in this chapter provide mechanisms for
networking and inter-processes communication.
Some modules only work for two processes that are on the same machine, e.g.
:mod:`signal` and :mod:`mmap`. Other modules support networking protocols
......@@ -15,6 +15,7 @@ The list of modules described in this chapter is:
.. toctree::
:maxdepth: 1
asyncio.rst
socket.rst
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment