Skip to content

Commit 8f663aa

Browse files
Merge remote-tracking branch 'upstream/main' into tkinter-wrong-thread-crash
2 parents ee52c8e + 3fa72d5 commit 8f663aa

104 files changed

Lines changed: 2248 additions & 2050 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/library/tkinter.messagebox.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ Common message box styles and layouts include but are not limited to:
113113
.. function:: askretrycancel(title=None, message=None, **options)
114114

115115
Ask if operation should be retried. Shows buttons :data:`RETRY` and :data:`CANCEL`.
116-
Return ``True`` if the answer is yes and ``False`` otherwise.
116+
Return ``True`` if the answer is retry and ``False`` otherwise.
117117

118118
.. function:: askyesno(title=None, message=None, **options)
119119

Doc/library/tkinter.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -770,6 +770,8 @@ cursor
770770
The standard X cursor names from :file:`cursorfont.h` can be used, without the
771771
``XC_`` prefix. For example to get a hand cursor (``XC_hand2``), use the
772772
string ``"hand2"``. You can also specify a bitmap and mask file of your own.
773+
On Windows a cursor file (:file:`.cur` or :file:`.ani`) may be used directly,
774+
giving its path preceded with an ``@``, as in ``"@C:/cursors/bart.ani"``.
773775
See page 179 of Ousterhout's book.
774776

775777
distance
@@ -883,6 +885,20 @@ they are denoted in Tk, which can be useful when referring to the Tk man pages.
883885
| %d | detail | %D | delta |
884886
+----+---------------------+----+---------------------+
885887

888+
The ``add`` parameter above only affects the bindings you make yourself.
889+
Every widget also inherits *class bindings*
890+
that implement its standard behavior --
891+
for example a :class:`Text` widget binds :kbd:`Control-t`
892+
to transpose two characters.
893+
These are described in the bindings section of the widget's Tk man page
894+
(such as :manpage:`text(3tk)` or :manpage:`entry(3tk)`).
895+
896+
Class bindings are processed separately from your own,
897+
so binding an event yourself does not replace the default; both run.
898+
To suppress an unwanted default binding,
899+
bind the event on the widget
900+
and return the string ``"break"`` from your callback.
901+
886902

887903
The index parameter
888904
^^^^^^^^^^^^^^^^^^^

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:

0 commit comments

Comments
 (0)