Skip to content
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

gh-127949: add docs for asyncio policy deprecation #128269

Merged
merged 6 commits into from
Dec 26, 2024
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
8 changes: 8 additions & 0 deletions Doc/library/asyncio-policy.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@
Policies
========

.. warning::

Policies are deprecated and will be removed in Python 3.16.
Users are encouraged to use the :func:`asyncio.run` function
or the :class:`asyncio.Runner` with *loop_factory* to use
the desired loop implementation.


An event loop policy is a global object
used to get and set the current :ref:`event loop <asyncio-event-loop>`,
as well as create new event loops.
Expand Down
34 changes: 30 additions & 4 deletions Doc/whatsnew/3.14.rst
Original file line number Diff line number Diff line change
Expand Up @@ -691,10 +691,36 @@ Deprecated
(Contributed by Serhiy Storchaka in :gh:`58032`.)

* :mod:`asyncio`:
:func:`!asyncio.iscoroutinefunction` is deprecated
and will be removed in Python 3.16,
use :func:`inspect.iscoroutinefunction` instead.
(Contributed by Jiahao Li and Kumar Aditya in :gh:`122875`.)

* :func:`!asyncio.iscoroutinefunction` is deprecated
and will be removed in Python 3.16;
use :func:`inspect.iscoroutinefunction` instead.
(Contributed by Jiahao Li and Kumar Aditya in :gh:`122875`.)

* :mod:`asyncio` policy system is deprecated and will be removed in Python 3.16.
In particular, the following classes and functions are deprecated:

* :class:`asyncio.AbstractEventLoopPolicy`
* :class:`asyncio.DefaultEventLoopPolicy`
* :class:`asyncio.WindowsSelectorEventLoopPolicy`
* :class:`asyncio.WindowsProactorEventLoopPolicy`
* :func:`asyncio.get_event_loop_policy`
* :func:`asyncio.set_event_loop_policy`
* :func:`asyncio.set_event_loop`
kumaraditya303 marked this conversation as resolved.
Show resolved Hide resolved

Users should use :func:`asyncio.run` or :class:`asyncio.Runner` with
*loop_factory* to use the desired event loop implementation.

For example, to use :class:`asyncio.SelectorEventLoop` on Windows::

import asyncio

async def main():
...

asyncio.run(main(), loop_factory=asyncio.SelectorEventLoop)

(Contributed by Kumar Aditya in :gh:`127949`.)

* :mod:`builtins`:
Passing a complex number as the *real* or *imag* argument in the
Expand Down
Loading