Skip to content

bpo-42392: Mention loop removal in whatsnew for 3.10 #24256

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Jan 21, 2021
Merged
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: 37 additions & 0 deletions Doc/whatsnew/3.10.rst
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,23 @@ Removed
the :mod:`collections` module.
(Contributed by Victor Stinner in :issue:`37324`.)

* The ``loop`` parameter has been removed from most of :mod:`asyncio`\ 's
:doc:`high-level API <../library/asyncio-api-index>` following deprecation
in Python 3.8. The motivation behind this change is multifold:

1. This simplifies the high-level API.
2. The functions in the high-level API have been implicitly getting the
current thread's running event loop since Python 3.7. There isn't a need to
pass the event loop to the API in most normal use cases.
3. Event loop passing is error-prone especially when dealing with loops
running in different threads.

Note that the low-level API will still accept ``loop``.
See `Changes in the Python API`_ for examples of how to replace existing code.

(Contributed by Yurii Karabas, Andrew Svetlov, Yury Selivanov and Kyle Stanley
in :issue:`42392`.)


Porting to Python 3.10
======================
Expand Down Expand Up @@ -596,6 +613,26 @@ Changes in the Python API
a 16-bit unsigned integer.
(Contributed by Erlend E. Aasland in :issue:`42393`.)

* The ``loop`` parameter has been removed from most of :mod:`asyncio`\ 's
:doc:`high-level API <../library/asyncio-api-index>` following deprecation
in Python 3.8.

A coroutine that currently look like this::

async def foo(loop):
await asyncio.sleep(1, loop=loop)

Should be replaced with this::

async def foo():
await asyncio.sleep(1)

If ``foo()`` was specifically designed *not* to run in the current thread's
running event loop (e.g. running in another thread's event loop), consider
using :func:`asyncio.run_coroutine_threadsafe` instead.

(Contributed by Yurii Karabas, Andrew Svetlov, Yury Selivanov and Kyle Stanley
in :issue:`42392`.)

CPython bytecode changes
========================
Expand Down