bpo-42392: [docs] Add deprecated-removed loop labels for asyncio (GH-26357)

* Add deprecated-removed loop labels for all reelvant functions/classes in asyncio
This commit is contained in:
Ken Jin 2021-05-27 05:59:34 +08:00 committed by GitHub
parent f6fbdb90ee
commit d8fd8c8568
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 153 additions and 0 deletions

View file

@ -105,6 +105,13 @@ Queue
Raises :exc:`ValueError` if called more times than there were Raises :exc:`ValueError` if called more times than there were
items placed in the queue. items placed in the queue.
.. deprecated-removed:: 3.8 3.10
The ``loop`` parameter. This function has been implicitly getting the
current running loop since 3.7. See
:ref:`What's New in 3.10's Removed section <whatsnew310-removed>`
for more information.
Priority Queue Priority Queue
============== ==============

View file

@ -70,6 +70,14 @@ and work with streams:
The *ssl_handshake_timeout* parameter. The *ssl_handshake_timeout* parameter.
.. deprecated-removed:: 3.8 3.10
The ``loop`` parameter. This function has been implicitly getting the
current running loop since 3.7. See
:ref:`What's New in 3.10's Removed section <whatsnew310-removed>`
for more information.
.. coroutinefunction:: start_server(client_connected_cb, host=None, \ .. coroutinefunction:: start_server(client_connected_cb, host=None, \
port=None, *, limit=None, \ port=None, *, limit=None, \
family=socket.AF_UNSPEC, \ family=socket.AF_UNSPEC, \
@ -100,6 +108,13 @@ and work with streams:
The *ssl_handshake_timeout* and *start_serving* parameters. The *ssl_handshake_timeout* and *start_serving* parameters.
.. deprecated-removed:: 3.8 3.10
The ``loop`` parameter. This function has been implicitly getting the
current running loop since 3.7. See
:ref:`What's New in 3.10's Removed section <whatsnew310-removed>`
for more information.
.. rubric:: Unix Sockets .. rubric:: Unix Sockets
@ -124,6 +139,13 @@ and work with streams:
The *path* parameter can now be a :term:`path-like object` The *path* parameter can now be a :term:`path-like object`
.. deprecated-removed:: 3.8 3.10
The ``loop`` parameter. This function has been implicitly getting the
current running loop since 3.7. See
:ref:`What's New in 3.10's Removed section <whatsnew310-removed>`
for more information.
.. coroutinefunction:: start_unix_server(client_connected_cb, path=None, \ .. coroutinefunction:: start_unix_server(client_connected_cb, path=None, \
*, limit=None, sock=None, backlog=100, ssl=None, \ *, limit=None, sock=None, backlog=100, ssl=None, \
@ -145,6 +167,13 @@ and work with streams:
The *path* parameter can now be a :term:`path-like object`. The *path* parameter can now be a :term:`path-like object`.
.. deprecated-removed:: 3.8 3.10
The ``loop`` parameter. This function has been implicitly getting the
current running loop since 3.7. See
:ref:`What's New in 3.10's Removed section <whatsnew310-removed>`
for more information.
StreamReader StreamReader
============ ============

View file

@ -75,6 +75,13 @@ Creating Subprocesses
See the documentation of :meth:`loop.subprocess_exec` for other See the documentation of :meth:`loop.subprocess_exec` for other
parameters. parameters.
.. deprecated-removed:: 3.8 3.10
The ``loop`` parameter. This function has been implicitly getting the
current running loop since 3.7. See
:ref:`What's New in 3.10's Removed section <whatsnew310-removed>`
for more information.
.. coroutinefunction:: create_subprocess_shell(cmd, stdin=None, \ .. coroutinefunction:: create_subprocess_shell(cmd, stdin=None, \
stdout=None, stderr=None, limit=None, **kwds) stdout=None, stderr=None, limit=None, **kwds)
@ -99,6 +106,13 @@ Creating Subprocesses
escape whitespace and special shell characters in strings that are going escape whitespace and special shell characters in strings that are going
to be used to construct shell commands. to be used to construct shell commands.
.. deprecated-removed:: 3.8 3.10
The ``loop`` parameter. This function has been implicitly getting the
current running loop since 3.7. See
:ref:`What's New in 3.10's Removed section <whatsnew310-removed>`
for more information.
.. note:: .. note::
Subprocesses are available for Windows if a :class:`ProactorEventLoop` is Subprocesses are available for Windows if a :class:`ProactorEventLoop` is

View file

@ -63,6 +63,12 @@ Lock
finally: finally:
lock.release() lock.release()
.. deprecated-removed:: 3.8 3.10
The ``loop`` parameter. This class has been implicitly getting the
current running loop since 3.7. See
:ref:`What's New in 3.10's Removed section <whatsnew310-removed>`
for more information.
.. coroutinemethod:: acquire() .. coroutinemethod:: acquire()
Acquire the lock. Acquire the lock.
@ -105,6 +111,12 @@ Event
:meth:`clear` method. The :meth:`~Event.wait` method blocks until the :meth:`clear` method. The :meth:`~Event.wait` method blocks until the
flag is set to *true*. The flag is set to *false* initially. flag is set to *true*. The flag is set to *false* initially.
.. deprecated-removed:: 3.8 3.10
The ``loop`` parameter. This class has been implicitly getting the
current running loop since 3.7. See
:ref:`What's New in 3.10's Removed section <whatsnew310-removed>`
for more information.
.. _asyncio_example_sync_event: .. _asyncio_example_sync_event:
Example:: Example::
@ -177,6 +189,12 @@ Condition
``None``. In the latter case a new Lock object is created ``None``. In the latter case a new Lock object is created
automatically. automatically.
.. deprecated-removed:: 3.8 3.10
The ``loop`` parameter. This class has been implicitly getting the
current running loop since 3.7. See
:ref:`What's New in 3.10's Removed section <whatsnew310-removed>`
for more information.
The preferred way to use a Condition is an :keyword:`async with` The preferred way to use a Condition is an :keyword:`async with`
statement:: statement::
@ -273,6 +291,12 @@ Semaphore
internal counter (``1`` by default). If the given value is internal counter (``1`` by default). If the given value is
less than ``0`` a :exc:`ValueError` is raised. less than ``0`` a :exc:`ValueError` is raised.
.. deprecated-removed:: 3.8 3.10
The ``loop`` parameter. This class has been implicitly getting the
current running loop since 3.7. See
:ref:`What's New in 3.10's Removed section <whatsnew310-removed>`
for more information.
The preferred way to use a Semaphore is an :keyword:`async with` The preferred way to use a Semaphore is an :keyword:`async with`
statement:: statement::
@ -325,6 +349,13 @@ BoundedSemaphore
a :exc:`ValueError` in :meth:`~Semaphore.release` if it a :exc:`ValueError` in :meth:`~Semaphore.release` if it
increases the internal counter above the initial *value*. increases the internal counter above the initial *value*.
.. deprecated-removed:: 3.8 3.10
The ``loop`` parameter. This class has been implicitly getting the
current running loop since 3.7. See
:ref:`What's New in 3.10's Removed section <whatsnew310-removed>`
for more information.
--------- ---------

View file

@ -297,6 +297,12 @@ Sleeping
tasks to run. This can be used by long-running functions to avoid tasks to run. This can be used by long-running functions to avoid
blocking the event loop for the full duration of the function call. blocking the event loop for the full duration of the function call.
.. deprecated-removed:: 3.8 3.10
The ``loop`` parameter. This function has been implicitly getting the
current running loop since 3.7. See
:ref:`What's New in 3.10's Removed section <whatsnew310-removed>`
for more information.
.. _asyncio_example_sleep: .. _asyncio_example_sleep:
Example of coroutine displaying the current date every second Example of coroutine displaying the current date every second
@ -317,6 +323,14 @@ Sleeping
asyncio.run(display_date()) asyncio.run(display_date())
.. deprecated-removed:: 3.8 3.10
The ``loop`` parameter. This function has been implicitly getting the
current running loop since 3.7. See
:ref:`What's New in 3.10's Removed section <whatsnew310-removed>`
for more information.
Running Tasks Concurrently Running Tasks Concurrently
========================== ==========================
@ -349,6 +363,12 @@ Running Tasks Concurrently
cancellation of one submitted Task/Future to cause other cancellation of one submitted Task/Future to cause other
Tasks/Futures to be cancelled. Tasks/Futures to be cancelled.
.. deprecated-removed:: 3.8 3.10
The ``loop`` parameter. This function has been implicitly getting the
current running loop since 3.7. See
:ref:`What's New in 3.10's Removed section <whatsnew310-removed>`
for more information.
.. _asyncio_example_gather: .. _asyncio_example_gather:
Example:: Example::
@ -400,6 +420,12 @@ Running Tasks Concurrently
If the *gather* itself is cancelled, the cancellation is If the *gather* itself is cancelled, the cancellation is
propagated regardless of *return_exceptions*. propagated regardless of *return_exceptions*.
.. deprecated-removed:: 3.8 3.10
The ``loop`` parameter. This function has been implicitly getting the
current running loop since 3.7. See
:ref:`What's New in 3.10's Removed section <whatsnew310-removed>`
for more information.
.. deprecated:: 3.10 .. deprecated:: 3.10
Deprecation warning is emitted if no positional arguments are provided Deprecation warning is emitted if no positional arguments are provided
or not all positional arguments are Future-like objects or not all positional arguments are Future-like objects
@ -442,6 +468,12 @@ Shielding From Cancellation
except CancelledError: except CancelledError:
res = None res = None
.. deprecated-removed:: 3.8 3.10
The ``loop`` parameter. This function has been implicitly getting the
current running loop since 3.7. See
:ref:`What's New in 3.10's Removed section <whatsnew310-removed>`
for more information.
.. deprecated:: 3.10 .. deprecated:: 3.10
Deprecation warning is emitted if *aw* is not Future-like object Deprecation warning is emitted if *aw* is not Future-like object
and there is no running event loop. and there is no running event loop.
@ -473,6 +505,12 @@ Timeouts
If the wait is cancelled, the future *aw* is also cancelled. If the wait is cancelled, the future *aw* is also cancelled.
.. deprecated-removed:: 3.8 3.10
The ``loop`` parameter. This function has been implicitly getting the
current running loop since 3.7. See
:ref:`What's New in 3.10's Removed section <whatsnew310-removed>`
for more information.
.. _asyncio_example_waitfor: .. _asyncio_example_waitfor:
Example:: Example::
@ -500,6 +538,12 @@ Timeouts
for *aw* to be cancelled. Previously, it raised for *aw* to be cancelled. Previously, it raised
:exc:`asyncio.TimeoutError` immediately. :exc:`asyncio.TimeoutError` immediately.
.. deprecated-removed:: 3.8 3.10
The ``loop`` parameter. This function has been implicitly getting the
current running loop since 3.7. See
:ref:`What's New in 3.10's Removed section <whatsnew310-removed>`
for more information.
Waiting Primitives Waiting Primitives
================== ==================
@ -556,6 +600,12 @@ Waiting Primitives
``wait()`` directly is deprecated as it leads to ``wait()`` directly is deprecated as it leads to
:ref:`confusing behavior <asyncio_example_wait_coroutine>`. :ref:`confusing behavior <asyncio_example_wait_coroutine>`.
.. deprecated-removed:: 3.8 3.10
The ``loop`` parameter. This function has been implicitly getting the
current running loop since 3.7. See
:ref:`What's New in 3.10's Removed section <whatsnew310-removed>`
for more information.
.. _asyncio_example_wait_coroutine: .. _asyncio_example_wait_coroutine:
.. note:: .. note::
@ -583,6 +633,13 @@ Waiting Primitives
if task in done: if task in done:
# Everything will work as expected now. # Everything will work as expected now.
.. deprecated-removed:: 3.8 3.10
The ``loop`` parameter. This function has been implicitly getting the
current running loop since 3.7. See
:ref:`What's New in 3.10's Removed section <whatsnew310-removed>`
for more information.
.. deprecated-removed:: 3.8 3.11 .. deprecated-removed:: 3.8 3.11
Passing coroutine objects to ``wait()`` directly is Passing coroutine objects to ``wait()`` directly is
@ -599,12 +656,24 @@ Waiting Primitives
Raises :exc:`asyncio.TimeoutError` if the timeout occurs before Raises :exc:`asyncio.TimeoutError` if the timeout occurs before
all Futures are done. all Futures are done.
.. deprecated-removed:: 3.8 3.10
The ``loop`` parameter. This function has been implicitly getting the
current running loop since 3.7. See
:ref:`What's New in 3.10's Removed section <whatsnew310-removed>`
for more information.
Example:: Example::
for coro in as_completed(aws): for coro in as_completed(aws):
earliest_result = await coro earliest_result = await coro
# ... # ...
.. deprecated-removed:: 3.8 3.10
The ``loop`` parameter. This function has been implicitly getting the
current running loop since 3.7. See
:ref:`What's New in 3.10's Removed section <whatsnew310-removed>`
for more information.
.. deprecated:: 3.10 .. deprecated:: 3.10
Deprecation warning is emitted if not all awaitable objects in the *aws* Deprecation warning is emitted if not all awaitable objects in the *aws*
iterable are Future-like objects and there is no running event loop. iterable are Future-like objects and there is no running event loop.

View file

@ -1578,6 +1578,7 @@ Deprecated
* ``cgi.log()`` is deprecated and slated for removal in Python 3.12. * ``cgi.log()`` is deprecated and slated for removal in Python 3.12.
(Contributed by Inada Naoki in :issue:`41139`.) (Contributed by Inada Naoki in :issue:`41139`.)
.. _whatsnew310-removed:
Removed Removed
======= =======

View file

@ -0,0 +1,2 @@
Document the deprecation and removal of the ``loop`` parameter for many
functions and classes in :mod:`asyncio`.