Skip to content

Commit b604fa3

Browse files
Merge remote-tracking branch 'upstream/main' into curses-term-attrs
# Conflicts: # Doc/whatsnew/3.16.rst # Modules/clinic/_cursesmodule.c.h
2 parents d3bafbc + b3154aa commit b604fa3

84 files changed

Lines changed: 788 additions & 726 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Doc/deprecations/pending-removal-in-3.16.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ Pending removal in Python 3.16
3333
* :mod:`asyncio` policy system is deprecated and will be removed in Python 3.16.
3434
In particular, the following classes and functions are deprecated:
3535

36-
* :class:`asyncio.AbstractEventLoopPolicy`
37-
* :class:`asyncio.DefaultEventLoopPolicy`
38-
* :class:`asyncio.WindowsSelectorEventLoopPolicy`
39-
* :class:`asyncio.WindowsProactorEventLoopPolicy`
40-
* :func:`asyncio.get_event_loop_policy`
41-
* :func:`asyncio.set_event_loop_policy`
36+
* :class:`!asyncio.AbstractEventLoopPolicy`
37+
* :class:`!asyncio.DefaultEventLoopPolicy`
38+
* :class:`!asyncio.WindowsSelectorEventLoopPolicy`
39+
* :class:`!asyncio.WindowsProactorEventLoopPolicy`
40+
* :func:`!asyncio.get_event_loop_policy`
41+
* :func:`!asyncio.set_event_loop_policy`
4242

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

Doc/library/asyncio-eventloop.rst

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@ an event loop:
4848
running event loop.
4949

5050
If there is no running event loop set, the function will return
51-
the result of the ``get_event_loop_policy().get_event_loop()`` call.
51+
the loop set by :func:`set_event_loop`, or raise a :exc:`RuntimeError`
52+
if no loop has been set.
5253

53-
Because this function has rather complex behavior (especially
54-
when custom event loop policies are in use), using the
54+
Because this function has rather complex behavior, using the
5555
:func:`get_running_loop` function is preferred to :func:`get_event_loop`
5656
in coroutines and callbacks.
5757

@@ -62,13 +62,6 @@ an event loop:
6262
.. versionchanged:: 3.14
6363
Raises a :exc:`RuntimeError` if there is no current event loop.
6464

65-
.. note::
66-
67-
The :mod:`!asyncio` policy system is deprecated and will be removed
68-
in Python 3.16; from there on, this function will return the current
69-
running event loop if present else it will return the
70-
loop set by :func:`set_event_loop`.
71-
7265
.. function:: set_event_loop(loop)
7366

7467
Set *loop* as the current event loop for the current OS thread.
@@ -77,10 +70,6 @@ an event loop:
7770

7871
Create and return a new event loop object.
7972

80-
Note that the behaviour of :func:`get_event_loop`, :func:`set_event_loop`,
81-
and :func:`new_event_loop` functions can be altered by
82-
:ref:`setting a custom event loop policy <asyncio-policies>`.
83-
8473

8574
.. rubric:: Contents
8675

Doc/library/asyncio-llapi-index.rst

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ Obtaining the Event Loop
1919
- The **preferred** function to get the running event loop.
2020

2121
* - :func:`asyncio.get_event_loop`
22-
- Get an event loop instance (running or current via the current policy).
22+
- Get the running event loop or the event loop set for the current thread.
2323

2424
* - :func:`asyncio.set_event_loop`
25-
- Set the event loop as current via the current policy.
25+
- Set the event loop for the current thread.
2626

2727
* - :func:`asyncio.new_event_loop`
2828
- Create a new event loop.
@@ -497,27 +497,3 @@ Protocol classes can implement the following **callback methods**:
497497
- Called when the child process has exited. It can be called before
498498
:meth:`~SubprocessProtocol.pipe_data_received` and
499499
:meth:`~SubprocessProtocol.pipe_connection_lost` methods.
500-
501-
502-
Event Loop Policies
503-
===================
504-
505-
Policies is a low-level mechanism to alter the behavior of
506-
functions like :func:`asyncio.get_event_loop`. See also
507-
the main :ref:`policies section <asyncio-policies>` for more
508-
details.
509-
510-
511-
.. rubric:: Accessing Policies
512-
.. list-table::
513-
:widths: 50 50
514-
:class: full-width-table
515-
516-
* - :meth:`asyncio.get_event_loop_policy`
517-
- Return the current process-wide policy.
518-
519-
* - :meth:`asyncio.set_event_loop_policy`
520-
- Set a new process-wide policy.
521-
522-
* - :class:`AbstractEventLoopPolicy`
523-
- Base class for policy objects.

Doc/library/asyncio-policy.rst

Lines changed: 0 additions & 173 deletions
This file was deleted.

Doc/library/asyncio-runner.rst

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,7 @@ Running an asyncio Program
4343
otherwise :func:`asyncio.new_event_loop` is used. The loop is closed at the end.
4444
This function should be used as a main entry point for asyncio programs,
4545
and should ideally only be called once. It is recommended to use
46-
*loop_factory* to configure the event loop instead of policies.
47-
Passing :class:`asyncio.EventLoop` allows running asyncio without the
48-
policy system.
46+
*loop_factory* to configure the event loop.
4947

5048
The executor is given a timeout duration of 5 minutes to shutdown.
5149
If the executor hasn't finished within that duration, a warning is
@@ -76,12 +74,6 @@ Running an asyncio Program
7674

7775
*coro* can be any awaitable object.
7876

79-
.. note::
80-
81-
The :mod:`!asyncio` policy system is deprecated and will be removed
82-
in Python 3.16; from there on, an explicit *loop_factory* is needed
83-
to configure the event loop.
84-
8577

8678
Runner context manager
8779
======================

Doc/library/asyncio.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ for full functionality and the latest features.
117117
asyncio-eventloop.rst
118118
asyncio-future.rst
119119
asyncio-protocol.rst
120-
asyncio-policy.rst
121120
asyncio-platforms.rst
122121
asyncio-extending.rst
123122

Doc/library/curses.rst

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,37 @@ The module :mod:`!curses` defines the following functions:
345345
a key with that value.
346346

347347

348+
.. function:: define_key(definition, keycode)
349+
350+
Define an escape sequence *definition*, a string, as a key that generates
351+
the key code *keycode*, so that :mod:`curses` interprets it like one of the
352+
keys predefined in the terminal database.
353+
354+
If *definition* is ``None``, any existing binding for *keycode* is removed.
355+
If *keycode* is zero or negative, any existing binding for *definition* is
356+
removed.
357+
358+
.. versionadded:: next
359+
360+
361+
.. function:: key_defined(definition)
362+
363+
Return the key code bound to the escape sequence *definition*, a string,
364+
``0`` if no key code is bound to it, or ``-1`` if *definition* is a prefix
365+
of a longer bound sequence (and so is ambiguous).
366+
367+
.. versionadded:: next
368+
369+
370+
.. function:: keyok(keycode, enable)
371+
372+
Enable (if *enable* is true) or disable (otherwise) interpretation of the
373+
key code *keycode*. Unlike :meth:`window.keypad`, this affects a single
374+
key code rather than all of them.
375+
376+
.. versionadded:: next
377+
378+
348379
.. function:: halfdelay(tenths)
349380

350381
Used for half-delay mode, which is similar to cbreak mode in that characters

Doc/tools/check-html-ids.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,10 @@ def do_check(baseline, checked, excluded, *, verbose_print):
7878
try:
7979
checked_ids = checked[name]
8080
except KeyError:
81-
successful = False
82-
print(f'{name}: (page missing)')
83-
print()
81+
if (name, '(page missing)') not in excluded:
82+
successful = False
83+
print(f'{name}: (page missing)')
84+
print()
8485
else:
8586
missing_ids = set(baseline_ids) - set(checked_ids)
8687
if missing_ids:

Doc/tools/removed-ids.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ c-api/file.html: deprecated-api
66

77
# Removed sections
88
library/asyncio-task.html: terminating-a-task-group
9+
library/asyncio-llapi-index.html: event-loop-policies
910
deprecations/index.html: pending-removal-in-python-3-15
1011
deprecations/index.html: pending-removal-in-python-3-16
1112
deprecations/index.html: c-api-pending-removal-in-python-3-15
@@ -35,3 +36,6 @@ reference/expressions.html: grammar-token-python-grammar-set_display
3536
# Moved to a different page
3637
c-api/typeobj.html: c.Py_tp_base
3738
c-api/typeobj.html: c.Py_tp_bases
39+
40+
# Removed pages
41+
library/asyncio-policy.html: (page missing)

Doc/whatsnew/3.14.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2628,12 +2628,12 @@ New deprecations
26282628
and will be removed in Python 3.16.
26292629
In particular, the following classes and functions are deprecated:
26302630

2631-
* :class:`asyncio.AbstractEventLoopPolicy`
2632-
* :class:`asyncio.DefaultEventLoopPolicy`
2633-
* :class:`asyncio.WindowsSelectorEventLoopPolicy`
2634-
* :class:`asyncio.WindowsProactorEventLoopPolicy`
2635-
* :func:`asyncio.get_event_loop_policy`
2636-
* :func:`asyncio.set_event_loop_policy`
2631+
* :class:`!asyncio.AbstractEventLoopPolicy`
2632+
* :class:`!asyncio.DefaultEventLoopPolicy`
2633+
* :class:`!asyncio.WindowsSelectorEventLoopPolicy`
2634+
* :class:`!asyncio.WindowsProactorEventLoopPolicy`
2635+
* :func:`!asyncio.get_event_loop_policy`
2636+
* :func:`!asyncio.set_event_loop_policy`
26372637

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

0 commit comments

Comments
 (0)