Skip to content

Commit d0ebf13

Browse files
Carreaumiss-islington
authored andcommitted
bpo-36932: use proper deprecation-removed directive (GH-13349)
.. And update some deprecation warnings with version numbers. https://bugs.python.org/issue36932
1 parent 3099ae4 commit d0ebf13

File tree

3 files changed

+31
-24
lines changed

3 files changed

+31
-24
lines changed

Doc/library/asyncio-task.rst

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -279,8 +279,8 @@ Sleeping
279279
``sleep()`` always suspends the current task, allowing other tasks
280280
to run.
281281

282-
The *loop* argument is deprecated and scheduled for removal
283-
in Python 3.10.
282+
.. deprecated-removed:: 3.8 3.10
283+
The *loop* parameter.
284284

285285
.. _asyncio_example_sleep:
286286

@@ -437,8 +437,8 @@ Timeouts
437437

438438
If the wait is cancelled, the future *aw* is also cancelled.
439439

440-
The *loop* argument is deprecated and scheduled for removal
441-
in Python 3.10.
440+
.. deprecated-removed:: 3.8 3.10
441+
The *loop* parameter.
442442

443443
.. _asyncio_example_waitfor:
444444

@@ -478,19 +478,21 @@ Waiting Primitives
478478
set concurrently and block until the condition specified
479479
by *return_when*.
480480

481-
If any awaitable in *aws* is a coroutine, it is automatically
482-
scheduled as a Task. Passing coroutines objects to
483-
``wait()`` directly is deprecated as it leads to
484-
:ref:`confusing behavior <asyncio_example_wait_coroutine>`.
481+
.. deprecated:: 3.8
482+
483+
If any awaitable in *aws* is a coroutine, it is automatically
484+
scheduled as a Task. Passing coroutines objects to
485+
``wait()`` directly is deprecated as it leads to
486+
:ref:`confusing behavior <asyncio_example_wait_coroutine>`.
485487

486488
Returns two sets of Tasks/Futures: ``(done, pending)``.
487489

488490
Usage::
489491

490492
done, pending = await asyncio.wait(aws)
491493

492-
The *loop* argument is deprecated and scheduled for removal
493-
in Python 3.10.
494+
.. deprecated-removed:: 3.8 3.10
495+
The *loop* parameter.
494496

495497
*timeout* (a float or int), if specified, can be used to control
496498
the maximum number of seconds to wait before returning.
@@ -550,6 +552,8 @@ Waiting Primitives
550552
if task in done:
551553
# Everything will work as expected now.
552554

555+
.. deprecated:: 3.8
556+
553557
Passing coroutine objects to ``wait()`` directly is
554558
deprecated.
555559

@@ -868,8 +872,10 @@ Task Object
868872
If *loop* is ``None``, the :func:`get_event_loop` function
869873
is used to get the current loop.
870874

871-
This method is **deprecated** and will be removed in
872-
Python 3.9. Use the :func:`asyncio.all_tasks` function instead.
875+
.. deprecated-removed:: 3.7 3.9
876+
877+
Do not call this as a task method. Use the :func:`asyncio.all_tasks`
878+
function instead.
873879

874880
.. classmethod:: current_task(loop=None)
875881

@@ -878,9 +884,10 @@ Task Object
878884
If *loop* is ``None``, the :func:`get_event_loop` function
879885
is used to get the current loop.
880886

881-
This method is **deprecated** and will be removed in
882-
Python 3.9. Use the :func:`asyncio.current_task` function
883-
instead.
887+
.. deprecated-removed:: 3.7 3.9
888+
889+
Do not call this as a task method. Use the
890+
:func:`asyncio.current_task` function instead.
884891

885892

886893
.. _asyncio_generator_based_coro:

Doc/library/sys.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1353,7 +1353,7 @@ always available.
13531353
This function has been added on a provisional basis (see :pep:`411`
13541354
for details.) Use it only for debugging purposes.
13551355

1356-
.. deprecated:: 3.7
1356+
.. deprecated-removed:: 3.7 3.8
13571357
The coroutine wrapper functionality has been deprecated, and
13581358
will be removed in 3.8. See :issue:`32591` for details.
13591359

Lib/asyncio/tasks.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ def current_task(cls, loop=None):
9595
9696
None is returned when called not in the context of a Task.
9797
"""
98-
warnings.warn("Task.current_task() is deprecated, "
98+
warnings.warn("Task.current_task() is deprecated since Python 3.7, "
9999
"use asyncio.current_task() instead",
100100
DeprecationWarning,
101101
stacklevel=2)
@@ -109,7 +109,7 @@ def all_tasks(cls, loop=None):
109109
110110
By default all tasks for the current event loop are returned.
111111
"""
112-
warnings.warn("Task.all_tasks() is deprecated, "
112+
warnings.warn("Task.all_tasks() is deprecated since Python 3.7, "
113113
"use asyncio.all_tasks() instead",
114114
DeprecationWarning,
115115
stacklevel=2)
@@ -388,8 +388,8 @@ async def wait(fs, *, loop=None, timeout=None, return_when=ALL_COMPLETED):
388388
if loop is None:
389389
loop = events.get_running_loop()
390390
else:
391-
warnings.warn("The loop argument is deprecated and scheduled for "
392-
"removal in Python 3.10.",
391+
warnings.warn("The loop argument is deprecated since Python 3.8, "
392+
"and scheduled for removal in Python 3.10.",
393393
DeprecationWarning, stacklevel=2)
394394

395395
fs = {ensure_future(f, loop=loop) for f in set(fs)}
@@ -418,8 +418,8 @@ async def wait_for(fut, timeout, *, loop=None):
418418
if loop is None:
419419
loop = events.get_running_loop()
420420
else:
421-
warnings.warn("The loop argument is deprecated and scheduled for "
422-
"removal in Python 3.10.",
421+
warnings.warn("The loop argument is deprecated since Python 3.8, "
422+
"and scheduled for removal in Python 3.10.",
423423
DeprecationWarning, stacklevel=2)
424424

425425
if timeout is None:
@@ -600,8 +600,8 @@ async def sleep(delay, result=None, *, loop=None):
600600
if loop is None:
601601
loop = events.get_running_loop()
602602
else:
603-
warnings.warn("The loop argument is deprecated and scheduled for "
604-
"removal in Python 3.10.",
603+
warnings.warn("The loop argument is deprecated since Python 3.8, "
604+
"and scheduled for removal in Python 3.10.",
605605
DeprecationWarning, stacklevel=2)
606606

607607
future = loop.create_future()

0 commit comments

Comments
 (0)