Skip to content

Commit b901964

Browse files
committed
Merge branch 'master' into move-fractions-internal-docs
2 parents 0f20557 + ec053fe commit b901964

88 files changed

Lines changed: 1654 additions & 435 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.

‎.github/workflows/build.yml‎

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -167,14 +167,12 @@ jobs:
167167
- true
168168
interpreter:
169169
- switch-case
170+
- tail-call
170171
exclude:
171172
# Skip Win32 on free-threaded builds
172173
- { arch: Win32, free-threading: true }
173-
include:
174-
# msvc::musttail is currently only supported on x64,
175-
# and only supported on 3.15+.
176-
- { arch: x64, free-threading: false, interpreter: tail-call }
177-
- { arch: x64, free-threading: true, interpreter: tail-call }
174+
# Skip Win32 on tail-call interpreter builds
175+
- { arch: Win32, interpreter: tail-call }
178176
uses: $/.github/workflows/reusable-windows.yml
179177
with:
180178
arch: ${{ matrix.arch }}
@@ -549,9 +547,17 @@ jobs:
549547
run: |
550548
"$BUILD_DIR/host-python/bin/python3" -m test test_sysconfig test_site test_embed
551549
- name: Configure cross build
552-
run: ./configure --prefix="$BUILD_DIR/cross-python" --with-build-python="$BUILD_DIR/host-python/bin/python3"
550+
run: |
551+
# Exercise a native build whose builtin modules differ from the build Python.
552+
echo '_bisect _bisectmodule.c' > Modules/Setup.local
553+
./configure --prefix="$BUILD_DIR/cross-python" --with-build-python="$BUILD_DIR/host-python/bin/python3"
553554
- name: Install cross Python
554555
run: make -j8 install
556+
- name: Check native extension modules with a build Python
557+
run: |
558+
"$BUILD_DIR/host-python/bin/python3" -c "import sys; assert '_bisect' not in sys.builtin_module_names"
559+
"$BUILD_DIR/cross-python/bin/python3" -c "import _bisect, sys; assert '_bisect' in sys.builtin_module_names"
560+
PYTHONSTRICTEXTENSIONBUILD=1 make checksharedmods
555561
- name: Display build info
556562
run: |
557563
"$BUILD_DIR/cross-python/bin/python3" -m test.pythoninfo

‎Doc/library/curses.rst‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1032,10 +1032,15 @@ Terminfo database
10321032
Instantiate the bytes object *str* with the supplied parameters, where *str* should
10331033
be a parameterized byte string obtained from the terminfo database. For example,
10341034
``tparm(tigetstr("cup"), 5, 3)`` could result in ``b'\033[6;4H'``, the exact
1035-
result depending on terminal type. Up to nine integer parameters may be supplied.
1035+
result depending on terminal type. Up to nine parameters may be supplied.
1036+
They are integers, except in a few cases, such as ``Ms`` of xterm,
1037+
where they must be bytes objects.
10361038

10371039
:func:`setupterm` (or :func:`initscr`) must be called first.
10381040

1041+
.. versionchanged:: next
1042+
Added support of bytes parameters.
1043+
10391044
.. function:: putp(str)
10401045

10411046
Equivalent to ``tputs(str, 1, putchar)``; emit the value of a specified

‎Doc/library/runpy.rst‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,9 @@ The :mod:`!runpy` module provides two functions:
114114
For a simple script, the specified code is simply executed in a fresh
115115
module namespace. For a valid :data:`sys.path` entry (typically a zipfile or
116116
directory), the entry is first added to the beginning of ``sys.path``. The
117-
function then looks for and executes a :mod:`__main__` module using the
118-
updated path. Note that there is no special protection against invoking
119-
an existing ``__main__`` entry located elsewhere on ``sys.path`` if
120-
there is no such module at the specified location.
117+
function then looks for and executes a :mod:`__main__` module in that
118+
entry. :exc:`ImportError` is raised if there is no such module at the
119+
specified location.
121120

122121
The optional dictionary argument *init_globals* may be used to pre-populate
123122
the module's globals dictionary before the code is executed.
@@ -177,6 +176,9 @@ The :mod:`!runpy` module provides two functions:
177176
.. versionchanged:: 3.15
178177
The global variable ``__cached__`` is no longer set.
179178

179+
.. versionchanged:: next
180+
The ``__main__`` module is now searched only in *path_name*.
181+
180182
.. seealso::
181183

182184
:pep:`338` -- Executing modules as scripts

‎Doc/library/subprocess.rst‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1326,7 +1326,7 @@ calls these functions.
13261326
... "ls non_existent_file; exit 0",
13271327
... stderr=subprocess.STDOUT,
13281328
... shell=True)
1329-
'ls: non_existent_file: No such file or directory\n'
1329+
b'ls: non_existent_file: No such file or directory\n'
13301330

13311331
.. versionadded:: 3.1
13321332

‎Doc/library/test.rst‎

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -517,6 +517,8 @@ The :mod:`!test.support` module defines the following functions:
517517
``True`` if called by a function whose ``__name__`` is ``'__main__'``.
518518
Used when tests are executed by :mod:`test.regrtest`.
519519

520+
If called at the top level, sets label "requires\_\ *resource*" on the module.
521+
520522

521523
.. function:: sortdict(dict)
522524

@@ -533,6 +535,29 @@ The :mod:`!test.support` module defines the following functions:
533535
rather than looking directly in the path directories.
534536

535537

538+
.. function:: mark(label, value=True, /)
539+
540+
Add a label to a test. Use ``@mark('label')`` as a decorator of a test
541+
method or class.
542+
543+
The optional *value* (``True`` by default) is matched on the command line
544+
by ``--label label=value``, whereas ``--label label`` matches any value.
545+
546+
Many :mod:`test.support` decorators like :func:`requires_resource`,
547+
:func:`~test.support.cpython_only` or :func:`bigmemtest` add labels
548+
automatically.
549+
550+
551+
.. function:: mark_module(label, value=True, /, *, globals=None)
552+
553+
Add a label to every test of a module. Call it at the module level::
554+
555+
test.support.mark_module('pickletest')
556+
557+
The module is the caller, unless its :func:`globals` dict is passed as the
558+
*globals* argument.
559+
560+
536561
.. function:: get_pagesize()
537562

538563
Get size of a page in bytes.
@@ -777,26 +802,31 @@ The :mod:`!test.support` module defines the following functions:
777802
.. decorator:: requires_zlib
778803

779804
Decorator for skipping tests if :mod:`zlib` doesn't exist.
805+
Adds label "requires_zlib".
780806

781807

782808
.. decorator:: requires_gzip
783809

784810
Decorator for skipping tests if :mod:`gzip` doesn't exist.
811+
Adds label "requires_gzip".
785812

786813

787814
.. decorator:: requires_bz2
788815

789816
Decorator for skipping tests if :mod:`bz2` doesn't exist.
817+
Adds label "requires_bz2".
790818

791819

792820
.. decorator:: requires_lzma
793821

794822
Decorator for skipping tests if :mod:`lzma` doesn't exist.
823+
Adds label "requires_lzma".
795824

796825

797826
.. decorator:: requires_resource(resource)
798827

799828
Decorator for skipping tests if *resource* is not available.
829+
Adds label "requires\_\ *resource*".
800830

801831

802832
.. decorator:: requires_docstrings
@@ -813,12 +843,17 @@ The :mod:`!test.support` module defines the following functions:
813843
.. decorator:: cpython_only
814844

815845
Decorator for tests only applicable to CPython.
846+
Adds label "impl_detail_cpython".
816847

817848

818849
.. decorator:: impl_detail(msg=None, **guards)
819850

820851
Decorator for invoking :func:`check_impl_detail` on *guards*. If that
821852
returns ``False``, then uses *msg* as the reason for skipping the test.
853+
For every keyword argument *name* adds a label
854+
"impl_detail\_\ *name*" if its value is true or
855+
"impl_detail_no\_\ *name*" otherwise.
856+
822857

823858
.. decorator:: thread_unsafe(reason=None)
824859

@@ -853,10 +888,13 @@ The :mod:`!test.support` module defines the following functions:
853888
method may be less than the requested value. If *dry_run* is ``False``, it
854889
means the test doesn't support dummy runs when ``-M`` is not specified.
855890

891+
Adds label "bigmemtest".
892+
856893

857894
.. decorator:: bigaddrspacetest
858895

859896
Decorator for tests that fill the address space.
897+
Adds label "bigaddrspacetest".
860898

861899

862900
.. function:: linked_to_musl()
@@ -1800,6 +1838,8 @@ Importing modules
18001838
optional for others, set *required_on* to an iterable of platform prefixes
18011839
which will be compared against :data:`sys.platform`.
18021840

1841+
If called at the top level, sets label "requires\_\ *name*" on the module.
1842+
18031843
.. versionadded:: 3.1
18041844

18051845
.. function:: import_fresh_module(name, fresh=(), blocked=(), *, deprecated=False, usefrozen=False)

‎Doc/library/tkinter.rst‎

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2023,6 +2023,31 @@ Base and mixin classes
20232023

20242024
.. versionadded:: 3.16
20252025

2026+
The following members support assistive technologies such as screen
2027+
readers.
2028+
They require Tk 9.1 or newer.
2029+
Tk automatically exposes the standard widgets to the platform
2030+
accessibility API;
2031+
the :attr:`!accessible` attributes allow overriding what is exposed,
2032+
and the :class:`Accessible` methods allow registering custom widgets.
2033+
If no assistive technology is active when the application starts,
2034+
setting the attributes has no effect,
2035+
reading them returns ``0``,
2036+
and the methods do nothing (except :meth:`!tk_check_screenreader`).
2037+
2038+
.. method:: tk_check_screenreader()
2039+
2040+
Return whether a screen reader is currently running.
2041+
2042+
.. versionadded:: next
2043+
2044+
.. attribute:: accessible
2045+
2046+
The accessible attributes of the widget,
2047+
as an :class:`Accessible` object.
2048+
2049+
.. versionadded:: next
2050+
20262051
The methods with the ``busy_`` prefix manage the busy state of a window,
20272052
which shows a busy cursor and ignores user input.
20282053

@@ -2455,6 +2480,55 @@ Base and mixin classes
24552480
.. versionadded:: 3.11
24562481

24572482

2483+
.. class:: Accessible()
2484+
2485+
The accessible attributes of a widget,
2486+
returned by the :attr:`~Misc.accessible` property of the widget.
2487+
The attributes are exposed to assistive technologies
2488+
such as screen readers.
2489+
Requires Tk 9.1 or newer.
2490+
2491+
Setting an attribute overrides what Tk exposes for the widget;
2492+
reading an attribute that has not been set raises
2493+
:exc:`~tkinter.TclError`.
2494+
A widget must have a role before any other attribute is set or read,
2495+
otherwise :exc:`~tkinter.TclError` is raised.
2496+
Tk sets the role of most standard widgets when they are mapped;
2497+
for other widgets, or before that, set :attr:`!role` first.
2498+
The supported roles are ``Button``, ``Canvas``, ``Checkbutton``,
2499+
``Combobox``, ``Entry``, ``Label``, ``Listbox``, ``Menu``,
2500+
``Notebook``, ``Progressbar``, ``Scale``, ``Scrollbar``,
2501+
``Spinbox``, ``Table``, ``Text`` and ``Tree``.
2502+
2503+
.. versionadded:: next
2504+
2505+
.. attribute:: role
2506+
name
2507+
description
2508+
value
2509+
state
2510+
action
2511+
help
2512+
2513+
The accessible attributes of the widget.
2514+
2515+
.. method:: add_object()
2516+
2517+
Register the widget with the platform accessibility API.
2518+
This is only needed for custom widgets;
2519+
the standard widgets are registered automatically.
2520+
2521+
.. method:: emit_selection_change()
2522+
2523+
Notify the platform accessibility API that the selection in the
2524+
widget has changed.
2525+
2526+
.. method:: emit_focus_change()
2527+
2528+
Notify the platform accessibility API that the widget has received
2529+
focus.
2530+
Not available on macOS.
2531+
24582532

24592533
.. class:: Wm()
24602534

‎Doc/library/xml.dom.minidom.rst‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,15 @@ module documentation. This section lists the differences between the API and
147147
otherwise it is set to ``"no"``.
148148
Not stating the argument will omit the declaration from the document.
149149

150+
:exc:`ValueError` is raised if the content of the node cannot be
151+
represented in XML, for example if a comment contains ``"--"`` or
152+
a CDATA section contains ``"]]>"``.
153+
The characters are not checked:
154+
the text, the attribute values and the content of comments,
155+
processing instructions and CDATA sections are written as is.
156+
If they can contain characters which are not allowed in XML,
157+
check them with :func:`xml.is_valid_text` before serialization.
158+
150159
.. versionchanged:: 3.8
151160
The :meth:`writexml` method now preserves the attribute order specified
152161
by the user.

‎Doc/whatsnew/3.16.rst‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -893,6 +893,15 @@ tkinter
893893
native print dialog. It requires Tk 8.7/9.0 or newer.
894894
(Contributed by Serhiy Storchaka in :gh:`153256`.)
895895

896+
* Added :mod:`tkinter` support for the Tk 9.1 accessibility API: the
897+
:attr:`~tkinter.Misc.accessible` property of widgets returns an
898+
:class:`~tkinter.Accessible` object whose attributes are exposed to
899+
assistive technologies such as screen readers and whose methods register
900+
custom widgets with the platform accessibility API, and the
901+
:meth:`~tkinter.Misc.tk_check_screenreader` method reports whether a
902+
screen reader is running.
903+
(Contributed by Serhiy Storchaka in :gh:`145578`.)
904+
896905
* Added new window-management methods :meth:`~tkinter.Misc.winfo_isdark`
897906
(dark mode detection), :meth:`~tkinter.Wm.wm_iconbadge` (application icon
898907
badge) and :meth:`~tkinter.Wm.wm_stackorder` (toplevel stacking order).

‎InternalDocs/interpreter.md‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -525,8 +525,9 @@ There are three different types of interpreters to choose from based on compiler
525525
[preserve_none](https://clang.llvm.org/docs/AttributeReference.html#preserve-none)
526526
calling convention between the small C functions that implement individual Python opcodes.
527527

528-
Not all compilers support these and if they do not all targets might be supported (for example,
529-
MSVC currently only supports x64 and only in optimized builds).
528+
Support depends on the compiler and target architecture. With MSVC, the
529+
tail-calling interpreter is available only in optimized builds. The minimum
530+
MSVC version is 14.50 for x64 and 14.52 for ARM64.
530531

531532
In addition, compilers must do [escape analysis](https://gcc.gnu.org/onlinedocs/gcc/Common-Attributes.html#index-musttail)
532533
of the lifetimes of automatic variables, function parameters, and temporaries to ensure proper tail-calls. They

‎Lib/_pyio.py‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2100,10 +2100,14 @@ class TextIOWrapper(TextIOBase):
21002100
r"""Character and line based layer over a BufferedIOBase object, buffer.
21012101
21022102
encoding gives the name of the encoding that the stream will be
2103-
decoded or encoded with. It defaults to locale.getencoding().
2104-
2105-
errors determines the strictness of encoding and decoding (see the
2106-
codecs.register) and defaults to "strict".
2103+
decoded or encoded with. It defaults to UTF-8; if UTF-8 Mode is
2104+
disabled, the encoding returned by locale.getencoding() is used
2105+
instead. See the codecs module for the list of supported
2106+
encodings.
2107+
2108+
errors determines the strictness of encoding and decoding (see
2109+
help(codecs.Codec) or the documentation for codecs.register) and
2110+
defaults to "strict".
21072111
21082112
newline can be None, '', '\n', '\r', or '\r\n'. It controls the
21092113
handling of line endings. If it is None, universal newlines is

0 commit comments

Comments
 (0)