Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 22 additions & 15 deletions Doc/library/asyncio-task.rst
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,8 @@ Sleeping
``sleep()`` always suspends the current task, allowing other tasks
to run.

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

.. _asyncio_example_sleep:

Expand Down Expand Up @@ -437,8 +437,8 @@ Timeouts

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

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

.. _asyncio_example_waitfor:

Expand Down Expand Up @@ -478,19 +478,21 @@ Waiting Primitives
set concurrently and block until the condition specified
by *return_when*.

If any awaitable in *aws* is a coroutine, it is automatically
scheduled as a Task. Passing coroutines objects to
``wait()`` directly is deprecated as it leads to
:ref:`confusing behavior <asyncio_example_wait_coroutine>`.
.. deprecated:: 3.8

If any awaitable in *aws* is a coroutine, it is automatically
scheduled as a Task. Passing coroutines objects to
``wait()`` directly is deprecated as it leads to
:ref:`confusing behavior <asyncio_example_wait_coroutine>`.

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

Usage::

done, pending = await asyncio.wait(aws)

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

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

.. deprecated:: 3.8

Passing coroutine objects to ``wait()`` directly is
deprecated.

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

This method is **deprecated** and will be removed in
Python 3.9. Use the :func:`asyncio.all_tasks` function instead.
.. deprecated-removed:: 3.7 3.9

Do not call this as a task method. Use the :func:`asyncio.all_tasks`
function instead.

.. classmethod:: current_task(loop=None)

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

This method is **deprecated** and will be removed in
Python 3.9. Use the :func:`asyncio.current_task` function
instead.
.. deprecated-removed:: 3.7 3.9

Do not call this as a task method. Use the
:func:`asyncio.current_task` function instead.


.. _asyncio_generator_based_coro:
Expand Down
2 changes: 1 addition & 1 deletion Doc/library/sys.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1353,7 +1353,7 @@ always available.
This function has been added on a provisional basis (see :pep:`411`
for details.) Use it only for debugging purposes.

.. deprecated:: 3.7
.. deprecated-removed:: 3.7 3.8

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Side question:
Do we really want to remove it in 3.8?
If yes -- the time window is very close.
@1st1 we need your judgment for it.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should drop it. asyncio no longer needs it, AFAIK Trio considered using it but decided it's too slow.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can do it myself tomorrow.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!
Thank you very much!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@1st1 I've opened https://bugs.python.org/issue36933 yesterday to track the removal.

The coroutine wrapper functionality has been deprecated, and
will be removed in 3.8. See :issue:`32591` for details.

Expand Down
16 changes: 8 additions & 8 deletions Lib/asyncio/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def current_task(cls, loop=None):

None is returned when called not in the context of a Task.
"""
warnings.warn("Task.current_task() is deprecated, "
warnings.warn("Task.current_task() is deprecated since Python 3.7, "
"use asyncio.current_task() instead",
DeprecationWarning,
stacklevel=2)
Expand All @@ -109,7 +109,7 @@ def all_tasks(cls, loop=None):

By default all tasks for the current event loop are returned.
"""
warnings.warn("Task.all_tasks() is deprecated, "
warnings.warn("Task.all_tasks() is deprecated since Python 3.7, "
"use asyncio.all_tasks() instead",
DeprecationWarning,
stacklevel=2)
Expand Down Expand Up @@ -388,8 +388,8 @@ async def wait(fs, *, loop=None, timeout=None, return_when=ALL_COMPLETED):
if loop is None:
loop = events.get_running_loop()
else:
warnings.warn("The loop argument is deprecated and scheduled for "
"removal in Python 3.10.",
warnings.warn("The loop argument is deprecated since Python 3.8, "
"and scheduled for removal in Python 3.10.",
DeprecationWarning, stacklevel=2)

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

if timeout is None:
Expand Down Expand Up @@ -600,8 +600,8 @@ async def sleep(delay, result=None, *, loop=None):
if loop is None:
loop = events.get_running_loop()
else:
warnings.warn("The loop argument is deprecated and scheduled for "
"removal in Python 3.10.",
warnings.warn("The loop argument is deprecated since Python 3.8, "
"and scheduled for removal in Python 3.10.",
DeprecationWarning, stacklevel=2)

future = loop.create_future()
Expand Down