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 ...@@ -15,7 +15,7 @@ Utilities to run asyncio programs, create Tasks, and
await on multiple things with timeouts. await on multiple things with timeouts.
.. list-table:: .. list-table::
:widths: 30 70 :widths: 50 50
* - :func:`run` * - :func:`run`
- Create event loop, run a coroutine, close the loop. - Create event loop, run a coroutine, close the loop.
...@@ -71,7 +71,7 @@ implement connection pools, and pub/sub patterns. ...@@ -71,7 +71,7 @@ implement connection pools, and pub/sub patterns.
.. list-table:: .. list-table::
:widths: 30 70 :widths: 50 50
* - :class:`Queue` * - :class:`Queue`
- A FIFO queue. - A FIFO queue.
...@@ -97,7 +97,7 @@ Subprocesses ...@@ -97,7 +97,7 @@ Subprocesses
Utilities to spawn subprocesses and run shell commands. Utilities to spawn subprocesses and run shell commands.
.. list-table:: .. list-table::
:widths: 30 70 :widths: 50 50
* - ``await`` :func:`create_subprocess_exec` * - ``await`` :func:`create_subprocess_exec`
- Create a subprocess. - Create a subprocess.
...@@ -120,7 +120,7 @@ Streams ...@@ -120,7 +120,7 @@ Streams
High-level APIs to work with network IO. High-level APIs to work with network IO.
.. list-table:: .. list-table::
:widths: 30 70 :widths: 50 50
* - ``await`` :func:`open_connection` * - ``await`` :func:`open_connection`
- Establish a TCP connection. - Establish a TCP connection.
...@@ -155,7 +155,7 @@ Synchronization ...@@ -155,7 +155,7 @@ Synchronization
Threading-like synchronization primitives that can be used in Tasks. Threading-like synchronization primitives that can be used in Tasks.
.. list-table:: .. list-table::
:widths: 30 70 :widths: 50 50
* - :class:`Lock` * - :class:`Lock`
- A mutex lock. - A mutex lock.
...@@ -185,7 +185,7 @@ Exceptions ...@@ -185,7 +185,7 @@ Exceptions
========== ==========
.. list-table:: .. list-table::
:widths: 30 70 :widths: 50 50
* - :exc:`asyncio.TimeoutError` * - :exc:`asyncio.TimeoutError`
......
This diff is collapsed.
...@@ -1075,6 +1075,11 @@ Enabling debug mode ...@@ -1075,6 +1075,11 @@ Enabling debug mode
Set the debug mode of the event loop. 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:: .. seealso::
The :ref:`debug mode of asyncio <asyncio-debug-mode>`. The :ref:`debug mode of asyncio <asyncio-debug-mode>`.
......
...@@ -121,6 +121,16 @@ Future Object ...@@ -121,6 +121,16 @@ Future Object
or an exception set with :meth:`set_result` or or an exception set with :meth:`set_result` or
:meth:`set_exception` calls. :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) .. method:: add_done_callback(callback, *, context=None)
Add a callback to be run when the Future is *done*. Add a callback to be run when the Future is *done*.
...@@ -180,10 +190,6 @@ Future Object ...@@ -180,10 +190,6 @@ Future Object
.. versionadded:: 3.7 .. versionadded:: 3.7
.. method:: cancelled()
Return ``True`` if the Future was *cancelled*.
This example creates a Future object, creates and schedules an This example creates a Future object, creates and schedules an
asynchronous Task to set result for the Future, and waits until asynchronous Task to set result for the Future, and waits until
......
...@@ -32,8 +32,9 @@ asyncio provides a set of **high-level** APIs to: ...@@ -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: as well as **low-level** APIs for *library and framework developers* to:
* create and manage :ref:`event loops <asyncio-event-loop>`, which * create and manage :ref:`event loops <asyncio-event-loop>`, which
provide asynchronous APIs for networking, subprocesses, OS signals, provide asynchronous APIs for :meth:`networking <loop.create_server>`,
etc; running :meth:`subprocesses <loop.subprocess_exec>`,
handling :meth:`OS signals <loop.add_signal_handler>`, etc;
* implement efficient protocols using * implement efficient protocols using
:ref:`transports <asyncio-transports-protocols>`; :ref:`transports <asyncio-transports-protocols>`;
...@@ -75,11 +76,3 @@ Reference ...@@ -75,11 +76,3 @@ Reference
asyncio-api-index.rst asyncio-api-index.rst
asyncio-dev.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: .. _ipc:
***************************************** *****************************************
Interprocess Communication and Networking Networking and Interprocess Communication
***************************************** *****************************************
The modules described in this chapter provide mechanisms for different processes The modules described in this chapter provide mechanisms for
to communicate. networking and inter-processes communication.
Some modules only work for two processes that are on the same machine, e.g. 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 :mod:`signal` and :mod:`mmap`. Other modules support networking protocols
...@@ -15,6 +15,7 @@ The list of modules described in this chapter is: ...@@ -15,6 +15,7 @@ The list of modules described in this chapter is:
.. toctree:: .. toctree::
:maxdepth: 1
asyncio.rst asyncio.rst
socket.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