Skip to content

Commit ed5389c

Browse files
Merge branch 'main' into immortal
2 parents f42377a + 40a82ab commit ed5389c

File tree

131 files changed

+3421
-881
lines changed

Some content is hidden

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

131 files changed

+3421
-881
lines changed

.github/actionlint.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
self-hosted-runner:
2-
# Pending https://github.com/rhysd/actionlint/issues/533
3-
# and https://github.com/rhysd/actionlint/issues/571
4-
labels: ["windows-11-arm", "macos-15-intel"]
2+
# Pending https://github.com/rhysd/actionlint/pull/615
3+
labels: ["windows-2025-vs2026"]
54

65
config-variables: null
76

.github/workflows/tail-call.yml

Lines changed: 75 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,14 @@
11
name: Tail calling interpreter
22
on:
33
pull_request:
4-
paths:
4+
paths: &paths
55
- '.github/workflows/tail-call.yml'
66
- 'Python/bytecodes.c'
77
- 'Python/ceval.c'
88
- 'Python/ceval_macros.h'
99
- 'Python/generated_cases.c.h'
1010
push:
11-
paths:
12-
- '.github/workflows/tail-call.yml'
13-
- 'Python/bytecodes.c'
14-
- 'Python/ceval.c'
15-
- 'Python/ceval_macros.h'
16-
- 'Python/generated_cases.c.h'
11+
paths: *paths
1712
workflow_dispatch:
1813

1914
permissions:
@@ -25,107 +20,109 @@ concurrency:
2520

2621
env:
2722
FORCE_COLOR: 1
23+
LLVM_VERSION: 21
2824

2925
jobs:
30-
tail-call:
26+
windows:
3127
name: ${{ matrix.target }}
3228
runs-on: ${{ matrix.runner }}
33-
timeout-minutes: 90
29+
timeout-minutes: 60
3430
strategy:
3531
fail-fast: false
3632
matrix:
37-
target:
38-
# Un-comment as we add support for more platforms for tail-calling interpreters.
39-
# - i686-pc-windows-msvc/msvc
40-
- x86_64-pc-windows-msvc/msvc
41-
# - aarch64-pc-windows-msvc/msvc
42-
- x86_64-apple-darwin/clang
43-
- aarch64-apple-darwin/clang
44-
- x86_64-unknown-linux-gnu/gcc
45-
- aarch64-unknown-linux-gnu/gcc
46-
- free-threading
47-
llvm:
48-
- 20
4933
include:
50-
# - target: i686-pc-windows-msvc/msvc
51-
# architecture: Win32
52-
# runner: windows-2022
5334
- target: x86_64-pc-windows-msvc/msvc
5435
architecture: x64
55-
runner: windows-2022
56-
# - target: aarch64-pc-windows-msvc/msvc
57-
# architecture: ARM64
58-
# runner: windows-2022
59-
- target: x86_64-apple-darwin/clang
60-
architecture: x86_64
61-
runner: macos-15-intel
62-
- target: aarch64-apple-darwin/clang
63-
architecture: aarch64
64-
runner: macos-14
65-
- target: x86_64-unknown-linux-gnu/gcc
66-
architecture: x86_64
67-
runner: ubuntu-24.04
68-
- target: aarch64-unknown-linux-gnu/gcc
69-
architecture: aarch64
70-
runner: ubuntu-24.04-arm
71-
- target: free-threading
72-
architecture: x86_64
73-
runner: ubuntu-24.04
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
7444
steps:
7545
- uses: actions/checkout@v6
7646
with:
7747
persist-credentials: false
7848
- uses: actions/setup-python@v6
7949
with:
8050
python-version: '3.11'
81-
82-
- name: Native Windows MSVC (release)
83-
if: runner.os == 'Windows' && matrix.architecture != 'ARM64'
51+
- name: Build
8452
shell: pwsh
8553
run: |
86-
choco install visualstudio2026buildtools --no-progress -y --force --params "--add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --locale en-US --passive"
87-
$env:PATH = "C:\Program Files (x86)\Microsoft Visual Studio\18\BuildTools\MSBuild\Current\bin;$env:PATH"
8854
$env:PlatformToolset = "v145"
89-
./PCbuild/build.bat --tail-call-interp -c Release -p ${{ matrix.architecture }}
90-
./PCbuild/rt.bat -p ${{ matrix.architecture }} -q --multiprocess 0 --timeout 4500 --verbose2 --verbose3
91-
92-
# No tests (yet):
93-
- name: Emulated Windows Clang (release)
94-
if: runner.os == 'Windows' && matrix.architecture == 'ARM64'
55+
./PCbuild/build.bat --tail-call-interp ${{ matrix.build_flags }} -c Release -p ${{ matrix.architecture }}
56+
- name: Test
57+
if: matrix.run_tests
9558
shell: pwsh
9659
run: |
97-
choco install llvm --allow-downgrade --no-progress --version ${{ matrix.llvm }}.1.0
98-
$env:PlatformToolset = "clangcl"
99-
$env:LLVMToolsVersion = "${{ matrix.llvm }}.1.0"
100-
$env:LLVMInstallDir = "C:\Program Files\LLVM"
101-
./PCbuild/build.bat --tail-call-interp -p ${{ matrix.architecture }}
60+
./PCbuild/rt.bat -p ${{ matrix.architecture }} -q --multiprocess 0 --timeout 4500 --verbose2 --verbose3
10261
103-
- name: Native macOS (release)
104-
if: runner.os == 'macOS'
62+
macos:
63+
name: ${{ matrix.target }}
64+
runs-on: ${{ matrix.runner }}
65+
timeout-minutes: 60
66+
strategy:
67+
fail-fast: false
68+
matrix:
69+
include:
70+
- target: x86_64-apple-darwin/clang
71+
runner: macos-15-intel
72+
- target: aarch64-apple-darwin/clang
73+
runner: macos-14
74+
steps:
75+
- uses: actions/checkout@v6
76+
with:
77+
persist-credentials: false
78+
- uses: actions/setup-python@v6
79+
with:
80+
python-version: '3.11'
81+
- name: Install dependencies
10582
run: |
10683
brew update
107-
brew install llvm@${{ matrix.llvm }}
84+
brew install llvm@${{ env.LLVM_VERSION }}
85+
- name: Build
86+
run: |
10887
export SDKROOT="$(xcrun --show-sdk-path)"
109-
export PATH="/usr/local/opt/llvm@${{ matrix.llvm }}/bin:$PATH"
110-
export PATH="/opt/homebrew/opt/llvm@${{ matrix.llvm }}/bin:$PATH"
111-
CC=clang-20 ./configure --with-tail-call-interp
88+
export PATH="/usr/local/opt/llvm@${{ env.LLVM_VERSION }}/bin:$PATH"
89+
export PATH="/opt/homebrew/opt/llvm@${{ env.LLVM_VERSION }}/bin:$PATH"
90+
CC=clang-${{ env.LLVM_VERSION }} ./configure --with-tail-call-interp
11291
make all --jobs 4
92+
- name: Test
93+
run: |
11394
./python.exe -m test --multiprocess 0 --timeout 4500 --verbose2 --verbose3
11495
115-
- name: Native Linux (debug)
116-
if: runner.os == 'Linux' && matrix.target != 'free-threading'
96+
linux:
97+
name: ${{ matrix.target }}
98+
runs-on: ${{ matrix.runner }}
99+
timeout-minutes: 60
100+
strategy:
101+
fail-fast: false
102+
matrix:
103+
include:
104+
- target: x86_64-unknown-linux-gnu/gcc
105+
runner: ubuntu-24.04
106+
configure_flags: --with-pydebug
107+
- target: x86_64-unknown-linux-gnu/gcc-free-threading
108+
runner: ubuntu-24.04
109+
configure_flags: --disable-gil
110+
- target: aarch64-unknown-linux-gnu/gcc
111+
runner: ubuntu-24.04-arm
112+
configure_flags: --with-pydebug
113+
steps:
114+
- uses: actions/checkout@v6
115+
with:
116+
persist-credentials: false
117+
- uses: actions/setup-python@v6
118+
with:
119+
python-version: '3.11'
120+
- name: Build
117121
run: |
118-
sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)" ./llvm.sh ${{ matrix.llvm }}
119-
export PATH="$(llvm-config-${{ matrix.llvm }} --bindir):$PATH"
120-
CC=clang-20 ./configure --with-tail-call-interp --with-pydebug
122+
sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)" ./llvm.sh ${{ env.LLVM_VERSION }}
123+
export PATH="$(llvm-config-${{ env.LLVM_VERSION }} --bindir):$PATH"
124+
CC=clang-${{ env.LLVM_VERSION }} ./configure --with-tail-call-interp ${{ matrix.configure_flags }}
121125
make all --jobs 4
122-
./python -m test --multiprocess 0 --timeout 4500 --verbose2 --verbose3
123-
124-
- name: Native Linux with free-threading (release)
125-
if: matrix.target == 'free-threading'
126+
- name: Test
126127
run: |
127-
sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)" ./llvm.sh ${{ matrix.llvm }}
128-
export PATH="$(llvm-config-${{ matrix.llvm }} --bindir):$PATH"
129-
CC=clang-20 ./configure --with-tail-call-interp --disable-gil
130-
make all --jobs 4
131128
./python -m test --multiprocess 0 --timeout 4500 --verbose2 --verbose3

.pre-commit-config.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/astral-sh/ruff-pre-commit
3-
rev: v0.14.10
3+
rev: v0.15.0
44
hooks:
55
- id: ruff-check
66
name: Run Ruff (lint) on Apple/
@@ -52,14 +52,14 @@ repos:
5252
files: ^Tools/wasm/
5353

5454
- repo: https://github.com/psf/black-pre-commit-mirror
55-
rev: 25.12.0
55+
rev: 26.1.0
5656
hooks:
5757
- id: black
5858
name: Run Black on Tools/jit/
5959
files: ^Tools/jit/
6060

6161
- repo: https://github.com/Lucas-C/pre-commit-hooks
62-
rev: v1.5.5
62+
rev: v1.5.6
6363
hooks:
6464
- id: remove-tabs
6565
types: [python]
@@ -83,19 +83,19 @@ repos:
8383
files: '^\.github/CODEOWNERS|\.(gram)$'
8484

8585
- repo: https://github.com/python-jsonschema/check-jsonschema
86-
rev: 0.36.0
86+
rev: 0.36.1
8787
hooks:
8888
- id: check-dependabot
8989
- id: check-github-workflows
9090
- id: check-readthedocs
9191

9292
- repo: https://github.com/rhysd/actionlint
93-
rev: v1.7.9
93+
rev: v1.7.10
9494
hooks:
9595
- id: actionlint
9696

9797
- repo: https://github.com/woodruffw/zizmor-pre-commit
98-
rev: v1.19.0
98+
rev: v1.22.0
9999
hooks:
100100
- id: zizmor
101101

Doc/c-api/module.rst

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -725,10 +725,11 @@ remove it.
725725
726726
An array of additional slots, terminated by a ``{0, NULL}`` entry.
727727
728-
This array may not contain slots corresponding to :c:type:`PyModuleDef`
729-
members.
730-
For example, you cannot use :c:macro:`Py_mod_name` in :c:member:`!m_slots`;
731-
the module name must be given as :c:member:`PyModuleDef.m_name`.
728+
If the array contains slots corresponding to :c:type:`PyModuleDef`
729+
members, the values must match.
730+
For example, if you use :c:macro:`Py_mod_name` in :c:member:`!m_slots`,
731+
:c:member:`PyModuleDef.m_name` must be set to the same pointer
732+
(not just an equal string).
732733
733734
.. versionchanged:: 3.5
734735

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ although there is currently no date scheduled for their removal.
3535
* Support for ``__complex__()`` method returning a strict subclass of
3636
:class:`complex`: these methods will be required to return an instance of
3737
:class:`complex`.
38-
* Delegation of ``int()`` to ``__trunc__()`` method.
3938
* Passing a complex number as the *real* or *imag* argument in the
4039
:func:`complex` constructor is now deprecated; it should only be passed
4140
as a single positional argument.

Doc/library/argparse.rst

Lines changed: 42 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1771,7 +1771,7 @@ Subcommands
17711771
>>> parser.parse_args(['--foo', 'b', '--baz', 'Z'])
17721772
Namespace(baz='Z', foo=True)
17731773

1774-
Note that the object returned by :meth:`parse_args` will only contain
1774+
Note that the object returned by :meth:`~ArgumentParser.parse_args` will only contain
17751775
attributes for the main parser and the subparser that was selected by the
17761776
command line (and not any other subparsers). So in the example above, when
17771777
the ``a`` command is specified, only the ``foo`` and ``bar`` attributes are
@@ -1814,7 +1814,7 @@ Subcommands
18141814
-h, --help show this help message and exit
18151815
--baz {X,Y,Z} baz help
18161816

1817-
The :meth:`add_subparsers` method also supports ``title`` and ``description``
1817+
The :meth:`~ArgumentParser.add_subparsers` method also supports ``title`` and ``description``
18181818
keyword arguments. When either is present, the subparser's commands will
18191819
appear in their own group in the help output. For example::
18201820

@@ -1835,34 +1835,8 @@ Subcommands
18351835

18361836
{foo,bar} additional help
18371837

1838-
Furthermore, :meth:`~_SubParsersAction.add_parser` supports an additional
1839-
*aliases* argument,
1840-
which allows multiple strings to refer to the same subparser. This example,
1841-
like ``svn``, aliases ``co`` as a shorthand for ``checkout``::
1842-
1843-
>>> parser = argparse.ArgumentParser()
1844-
>>> subparsers = parser.add_subparsers()
1845-
>>> checkout = subparsers.add_parser('checkout', aliases=['co'])
1846-
>>> checkout.add_argument('foo')
1847-
>>> parser.parse_args(['co', 'bar'])
1848-
Namespace(foo='bar')
1849-
1850-
:meth:`~_SubParsersAction.add_parser` supports also an additional
1851-
*deprecated* argument, which allows to deprecate the subparser.
1852-
1853-
>>> import argparse
1854-
>>> parser = argparse.ArgumentParser(prog='chicken.py')
1855-
>>> subparsers = parser.add_subparsers()
1856-
>>> run = subparsers.add_parser('run')
1857-
>>> fly = subparsers.add_parser('fly', deprecated=True)
1858-
>>> parser.parse_args(['fly']) # doctest: +SKIP
1859-
chicken.py: warning: command 'fly' is deprecated
1860-
Namespace()
1861-
1862-
.. versionadded:: 3.13
1863-
18641838
One particularly effective way of handling subcommands is to combine the use
1865-
of the :meth:`add_subparsers` method with calls to :meth:`set_defaults` so
1839+
of the :meth:`~ArgumentParser.add_subparsers` method with calls to :meth:`~ArgumentParser.set_defaults` so
18661840
that each subparser knows which Python function it should execute. For
18671841
example::
18681842

@@ -1898,12 +1872,12 @@ Subcommands
18981872
>>> args.func(args)
18991873
((XYZYX))
19001874

1901-
This way, you can let :meth:`parse_args` do the job of calling the
1875+
This way, you can let :meth:`~ArgumentParser.parse_args` do the job of calling the
19021876
appropriate function after argument parsing is complete. Associating
19031877
functions with actions like this is typically the easiest way to handle the
19041878
different actions for each of your subparsers. However, if it is necessary
19051879
to check the name of the subparser that was invoked, the ``dest`` keyword
1906-
argument to the :meth:`add_subparsers` call will work::
1880+
argument to the :meth:`~ArgumentParser.add_subparsers` call will work::
19071881

19081882
>>> parser = argparse.ArgumentParser()
19091883
>>> subparsers = parser.add_subparsers(dest='subparser_name')
@@ -1922,6 +1896,43 @@ Subcommands
19221896
the main parser.
19231897

19241898

1899+
.. method:: _SubParsersAction.add_parser(name, *, help=None, aliases=None, \
1900+
deprecated=False, **kwargs)
1901+
1902+
Create and return a new :class:`ArgumentParser` object for the
1903+
subcommand *name*.
1904+
1905+
The *name* argument is the name of the sub-command.
1906+
1907+
The *help* argument provides a short description for this sub-command.
1908+
1909+
The *aliases* argument allows providing alternative names for this
1910+
sub-command. For example::
1911+
1912+
>>> parser = argparse.ArgumentParser()
1913+
>>> subparsers = parser.add_subparsers()
1914+
>>> checkout = subparsers.add_parser('checkout', aliases=['co'])
1915+
>>> checkout.add_argument('foo')
1916+
>>> parser.parse_args(['co', 'bar'])
1917+
Namespace(foo='bar')
1918+
1919+
The *deprecated* argument, if ``True``, marks the sub-command as
1920+
deprecated and will issue a warning when used. For example::
1921+
1922+
>>> parser = argparse.ArgumentParser(prog='chicken.py')
1923+
>>> subparsers = parser.add_subparsers()
1924+
>>> fly = subparsers.add_parser('fly', deprecated=True)
1925+
>>> args = parser.parse_args(['fly'])
1926+
chicken.py: warning: command 'fly' is deprecated
1927+
Namespace()
1928+
1929+
All other keyword arguments are passed directly to the
1930+
:class:`!ArgumentParser` constructor.
1931+
1932+
.. versionadded:: 3.13
1933+
Added the *deprecated* parameter.
1934+
1935+
19251936
FileType objects
19261937
^^^^^^^^^^^^^^^^
19271938

0 commit comments

Comments
 (0)