Skip to content

Commit 6de7669

Browse files
committed
Merge remote-tracking branch 'upstream' into fix-issue-140715--C
2 parents c2ef261 + 70d1b08 commit 6de7669

File tree

77 files changed

+3910
-1547
lines changed

Some content is hidden

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

77 files changed

+3910
-1547
lines changed

.github/workflows/build.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,13 +165,21 @@ jobs:
165165
free-threading:
166166
- false
167167
- true
168+
interpreter:
169+
- switch-case
168170
exclude:
169171
# Skip Win32 on free-threaded builds
170172
- { 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 }
171178
uses: ./.github/workflows/reusable-windows.yml
172179
with:
173180
arch: ${{ matrix.arch }}
174181
free-threading: ${{ matrix.free-threading }}
182+
interpreter: ${{ matrix.interpreter }}
175183

176184
build-windows-msi:
177185
# ${{ '' } is a hack to nest jobs under the same sidebar category.

.github/workflows/reusable-emscripten.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
build-emscripten-reusable:
1111
name: 'build and test'
1212
runs-on: ubuntu-24.04
13-
timeout-minutes: 60
13+
timeout-minutes: 40
1414
steps:
1515
- uses: actions/checkout@v6
1616
with:

.github/workflows/reusable-windows.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ on:
1212
required: false
1313
type: boolean
1414
default: false
15+
interpreter:
16+
description: Which interpreter to build (switch-case or tail-call)
17+
required: true
18+
type: string
1519

1620
env:
1721
FORCE_COLOR: 1
@@ -20,7 +24,7 @@ env:
2024
2125
jobs:
2226
build:
23-
name: Build and test (${{ inputs.arch }})
27+
name: Build and test (${{ inputs.arch }}, ${{ inputs.interpreter }})
2428
runs-on: ${{ inputs.arch == 'arm64' && 'windows-11-arm' || 'windows-2025-vs2026' }}
2529
timeout-minutes: 60
2630
env:
@@ -33,9 +37,12 @@ jobs:
3337
if: inputs.arch != 'Win32'
3438
run: echo "::add-matcher::.github/problem-matchers/msvc.json"
3539
- name: Build CPython
40+
# msvc::musttail is not supported for debug builds, so we have to
41+
# switch to release.
3642
run: >-
3743
.\\PCbuild\\build.bat
38-
-e -d -v
44+
-e -v
45+
${{ inputs.interpreter == 'switch-case' && '-d' || '--tail-call-interp -c Release' }}
3946
-p "${ARCH}"
4047
${{ fromJSON(inputs.free-threading) && '--disable-gil' || '' }}
4148
shell: bash
@@ -45,6 +52,7 @@ jobs:
4552
run: >-
4653
.\\PCbuild\\rt.bat
4754
-p "${ARCH}"
48-
-d -q --fast-ci
55+
-q --fast-ci
56+
${{ inputs.interpreter == 'switch-case' && '-d' || '' }}
4957
${{ fromJSON(inputs.free-threading) && '--disable-gil' || '' }}
5058
shell: bash

.github/workflows/tail-call.yml

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -23,41 +23,6 @@ env:
2323
LLVM_VERSION: 21
2424

2525
jobs:
26-
windows:
27-
name: ${{ matrix.target }}
28-
runs-on: ${{ matrix.runner }}
29-
timeout-minutes: 60
30-
strategy:
31-
fail-fast: false
32-
matrix:
33-
include:
34-
- target: x86_64-pc-windows-msvc/msvc
35-
architecture: x64
36-
runner: windows-2025-vs2026
37-
build_flags: ""
38-
run_tests: true
39-
- target: x86_64-pc-windows-msvc/msvc-free-threading
40-
architecture: x64
41-
runner: windows-2025-vs2026
42-
build_flags: --disable-gil
43-
run_tests: false
44-
steps:
45-
- uses: actions/checkout@v6
46-
with:
47-
persist-credentials: false
48-
- uses: actions/setup-python@v6
49-
with:
50-
python-version: '3.11'
51-
- name: Build
52-
shell: pwsh
53-
run: |
54-
./PCbuild/build.bat --tail-call-interp ${{ matrix.build_flags }} -c Release -p ${{ matrix.architecture }}
55-
- name: Test
56-
if: matrix.run_tests
57-
shell: pwsh
58-
run: |
59-
./PCbuild/rt.bat -p ${{ matrix.architecture }} -q --multiprocess 0 --timeout 4500 --verbose2 --verbose3
60-
6126
macos:
6227
name: ${{ matrix.target }}
6328
runs-on: ${{ matrix.runner }}

Doc/library/array.rst

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,15 @@ defined:
4242
+-----------+--------------------+-------------------+-----------------------+-------+
4343
| ``'Q'`` | unsigned long long | int | 8 | |
4444
+-----------+--------------------+-------------------+-----------------------+-------+
45+
| ``'e'`` | _Float16 | float | 2 | \(3) |
46+
+-----------+--------------------+-------------------+-----------------------+-------+
4547
| ``'f'`` | float | float | 4 | |
4648
+-----------+--------------------+-------------------+-----------------------+-------+
4749
| ``'d'`` | double | float | 8 | |
4850
+-----------+--------------------+-------------------+-----------------------+-------+
49-
| ``'F'`` | float complex | complex | 8 | \(3) |
51+
| ``'F'`` | float complex | complex | 8 | \(4) |
5052
+-----------+--------------------+-------------------+-----------------------+-------+
51-
| ``'D'`` | double complex | complex | 16 | \(3) |
53+
| ``'D'`` | double complex | complex | 16 | \(4) |
5254
+-----------+--------------------+-------------------+-----------------------+-------+
5355

5456

@@ -69,6 +71,15 @@ Notes:
6971
.. versionadded:: 3.13
7072

7173
(3)
74+
The IEEE 754 binary16 "half precision" type was introduced in the 2008
75+
revision of the `IEEE 754 standard <ieee 754 standard_>`_.
76+
This type is not widely supported by C compilers. It's available
77+
as :c:expr:`_Float16` type, if the compiler supports the Annex H
78+
of the C23 standard.
79+
80+
.. versionadded:: next
81+
82+
(4)
7283
Complex types (``F`` and ``D``) are available unconditionally,
7384
regardless on support for complex types (the Annex G of the C11 standard)
7485
by the C compiler.
@@ -304,3 +315,5 @@ Examples::
304315

305316
`NumPy <https://numpy.org/>`_
306317
The NumPy package defines another array type.
318+
319+
.. _ieee 754 standard: https://en.wikipedia.org/wiki/IEEE_754-2008_revision

Doc/library/getpass.rst

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,27 @@ The :mod:`!getpass` module provides two functions:
3939
On Unix systems, when *echo_char* is set, the terminal will be
4040
configured to operate in
4141
:manpage:`noncanonical mode <termios(3)#Canonical_and_noncanonical_mode>`.
42-
In particular, this means that line editing shortcuts such as
43-
:kbd:`Ctrl+U` will not work and may insert unexpected characters into
44-
the input.
42+
Common terminal control characters are supported:
43+
44+
* :kbd:`Ctrl+A` - Move cursor to beginning of line
45+
* :kbd:`Ctrl+E` - Move cursor to end of line
46+
* :kbd:`Ctrl+K` - Kill (delete) from cursor to end of line
47+
* :kbd:`Ctrl+U` - Kill (delete) entire line
48+
* :kbd:`Ctrl+W` - Erase previous word
49+
* :kbd:`Ctrl+V` - Insert next character literally (quote)
50+
* :kbd:`Backspace`/:kbd:`DEL` - Delete character before cursor
51+
52+
These shortcuts work by reading the terminal's configured control
53+
character mappings from termios settings.
4554

4655
.. versionchanged:: 3.14
4756
Added the *echo_char* parameter for keyboard feedback.
4857

58+
.. versionchanged:: next
59+
When using non-empty *echo_char* on Unix, keyboard shortcuts (including
60+
cursor movement and line editing) are now properly handled using the
61+
terminal's control character configuration.
62+
4963
.. exception:: GetPassWarning
5064

5165
A :exc:`UserWarning` subclass issued when password input may be echoed.

Doc/library/profiling.sampling.rst

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1003,6 +1003,47 @@ at the top indicate functions that consume significant time either directly
10031003
or through their callees.
10041004

10051005

1006+
Differential flame graphs
1007+
~~~~~~~~~~~~~~~~~~~~~~~~~
1008+
1009+
Differential flame graphs compare two profiling runs to highlight where
1010+
performance changed. This helps identify regressions introduced by code changes
1011+
and validate that optimizations achieved their intended effect::
1012+
1013+
# Capture baseline profile
1014+
python -m profiling.sampling run --binary -o baseline.bin script.py
1015+
1016+
# After modifying code, generate differential flamegraph
1017+
python -m profiling.sampling run --diff-flamegraph baseline.bin -o diff.html script.py
1018+
1019+
The visualization draws the current profile with frame widths showing current
1020+
time consumption, then applies color to indicate how each function changed
1021+
relative to the baseline.
1022+
1023+
**Color coding**:
1024+
1025+
- **Red**: Functions consuming more time (regressions). Lighter shades indicate
1026+
modest increases, while darker shades show severe regressions.
1027+
1028+
- **Blue**: Functions consuming less time (improvements). Lighter shades for
1029+
modest reductions, darker shades for significant speedups.
1030+
1031+
- **Gray**: Minimal or no change.
1032+
1033+
- **Purple**: New functions not present in the baseline.
1034+
1035+
Frame colors indicate changes in **direct time** (time when the function was at
1036+
the top of the stack, actively executing), not cumulative time including callees.
1037+
Hovering over a frame shows comparison details including baseline time, current
1038+
time, and the percentage change.
1039+
1040+
Some call paths may disappear entirely between profiles. These are called
1041+
**elided stacks** and occur when optimizations eliminate code paths or certain
1042+
branches stop executing. If elided stacks are present, an elided toggle appears
1043+
allowing you to switch between the main differential view and an elided-only
1044+
view that shows just the removed paths (colored purple).
1045+
1046+
10061047
Gecko format
10071048
------------
10081049

@@ -1488,6 +1529,10 @@ Output options
14881529

14891530
Generate self-contained HTML flame graph.
14901531

1532+
.. option:: --diff-flamegraph <baseline.bin>
1533+
1534+
Generate differential flamegraph comparing to a baseline binary profile.
1535+
14911536
.. option:: --gecko
14921537

14931538
Generate Gecko JSON format for Firefox Profiler.

Doc/library/select.rst

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ The module defines the following:
6262

6363
*sizehint* informs epoll about the expected number of events to be
6464
registered. It must be positive, or ``-1`` to use the default. It is only
65-
used on older systems where :c:func:`!epoll_create1` is not available;
65+
used on older systems where :manpage:`epoll_create1(2)` is not available;
6666
otherwise it has no effect (though its value is still checked).
6767

6868
*flags* is deprecated and completely ignored. However, when supplied, its
@@ -89,6 +89,11 @@ The module defines the following:
8989
The *flags* parameter. ``select.EPOLL_CLOEXEC`` is used by default now.
9090
Use :func:`os.set_inheritable` to make the file descriptor inheritable.
9191

92+
.. versionchanged:: next
93+
94+
When CPython is built, this function may be disabled using
95+
:option:`--disable-epoll`.
96+
9297

9398
.. function:: poll()
9499

Doc/library/xml.etree.elementtree.rst

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -691,7 +691,7 @@ Functions
691691
.. versionadded:: 3.2
692692

693693

694-
.. function:: SubElement(parent, tag, attrib={}, **extra)
694+
.. function:: SubElement(parent, tag, /, attrib={}, **extra)
695695

696696
Subelement factory. This function creates an element instance, and appends
697697
it to an existing element.
@@ -705,6 +705,9 @@ Functions
705705
.. versionchanged:: 3.15
706706
*attrib* can now be a :class:`frozendict`.
707707

708+
.. versionchanged:: next
709+
*parent* and *tag* are now positional-only parameters.
710+
708711

709712
.. function:: tostring(element, encoding="us-ascii", method="xml", *, \
710713
xml_declaration=None, default_namespace=None, \
@@ -880,7 +883,7 @@ Element Objects
880883
:noindex:
881884
:no-index:
882885

883-
.. class:: Element(tag, attrib={}, **extra)
886+
.. class:: Element(tag, /, attrib={}, **extra)
884887

885888
Element class. This class defines the Element interface, and provides a
886889
reference implementation of this interface.
@@ -893,6 +896,9 @@ Element Objects
893896
.. versionchanged:: 3.15
894897
*attrib* can now be a :class:`frozendict`.
895898

899+
.. versionchanged:: next
900+
*tag* is now a positional-only parameter.
901+
896902

897903
.. attribute:: tag
898904

Doc/using/configure.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,17 @@ General Options
463463

464464
``pkg-config`` options.
465465

466+
.. option:: --disable-epoll
467+
468+
Build without ``epoll``, meaning that :py:func:`select.epoll` will not be
469+
present even if the system provides an
470+
:manpage:`epoll_create <epoll_create(2)>` function.
471+
This may be used on systems where :manpage:`!epoll_create` or
472+
:manpage:`epoll_create1 <epoll_create1(2)>` is available
473+
but incompatible with Linux semantics.
474+
475+
.. versionadded:: next
476+
466477

467478
C compiler options
468479
------------------

0 commit comments

Comments
 (0)