Skip to content

Commit caf5984

Browse files
authored
Merge branch 'main' into pythongh-126985
2 parents 7e776b7 + a264637 commit caf5984

File tree

350 files changed

+5390
-3219
lines changed

Some content is hidden

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

350 files changed

+5390
-3219
lines changed

.github/CODEOWNERS

+12-1
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,17 @@ Programs/_bootstrap_python.c @ericsnowcurrently
8181
Programs/python.c @ericsnowcurrently
8282
Tools/build/generate_global_objects.py @ericsnowcurrently
8383

84+
# Initialization
85+
Doc/library/sys_path_init.rst @FFY00
86+
Doc/c-api/init_config.rst @FFY00
87+
88+
# getpath
89+
**/*getpath* @FFY00
90+
91+
# site
92+
**/*site.py @FFY00
93+
Doc/library/site.rst @FFY00
94+
8495
# Exceptions
8596
Lib/test/test_except*.py @iritkatriel
8697
Objects/exceptions.c @iritkatriel
@@ -97,7 +108,7 @@ Modules/_hacl/** @gpshead
97108
**/*logging* @vsajip
98109

99110
# venv
100-
**/*venv* @vsajip
111+
**/*venv* @vsajip @FFY00
101112

102113
# Launcher
103114
/PC/launcher.c @vsajip

.github/actionlint.yaml

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
self-hosted-runner:
2+
labels: ["ubuntu-24.04-aarch64", "windows-aarch64"]
3+
4+
config-variables: null
5+
6+
paths:
7+
.github/workflows/**/*.yml:
8+
ignore:
9+
- 1st argument of function call is not assignable
10+
- SC2(015|038|086|091|097|098|129|155)

.github/workflows/build.yml

+18-6
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353
steps:
5454
- name: Install Git
5555
run: |
56-
apt install git -yq
56+
apt update && apt install git -yq
5757
git config --global --add safe.directory "$GITHUB_WORKSPACE"
5858
- uses: actions/checkout@v4
5959
with:
@@ -150,16 +150,28 @@ jobs:
150150
needs: check_source
151151
if: fromJSON(needs.check_source.outputs.run_tests)
152152
strategy:
153+
fail-fast: false
153154
matrix:
155+
os:
156+
- windows-latest
154157
arch:
155-
- Win32
156-
- x64
157-
- arm64
158+
- x64
158159
free-threading:
159-
- false
160-
- true
160+
- false
161+
- true
162+
include:
163+
- os: windows-latest # FIXME(diegorusso): change to os: windows-aarch64
164+
arch: arm64
165+
free-threading: false
166+
- os: windows-latest # FIXME(diegorusso): change to os: windows-aarch64
167+
arch: arm64
168+
free-threading: true
169+
- os: windows-latest
170+
arch: Win32
171+
free-threading: false
161172
uses: ./.github/workflows/reusable-windows.yml
162173
with:
174+
os: ${{ matrix.os }}
163175
arch: ${{ matrix.arch }}
164176
free-threading: ${{ matrix.free-threading }}
165177

.github/workflows/reusable-ubuntu.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
strategy:
2121
fail-fast: false
2222
matrix:
23-
os: [ubuntu-24.04]
23+
os: [ubuntu-24.04, ubuntu-24.04-aarch64]
2424
env:
2525
FORCE_COLOR: 1
2626
OPENSSL_VER: 3.0.15
@@ -82,11 +82,11 @@ jobs:
8282
- name: Build CPython out-of-tree
8383
if: ${{ inputs.free-threading }}
8484
working-directory: ${{ env.CPYTHON_BUILDDIR }}
85-
run: make -j4
85+
run: make -j
8686
- name: Build CPython out-of-tree (for compiler warning check)
8787
if: ${{ !inputs.free-threading}}
8888
working-directory: ${{ env.CPYTHON_BUILDDIR }}
89-
run: set -o pipefail; make -j4 --output-sync 2>&1 | tee compiler_output_ubuntu.txt
89+
run: set -o pipefail; make -j --output-sync 2>&1 | tee compiler_output_ubuntu.txt
9090
- name: Display build info
9191
working-directory: ${{ env.CPYTHON_BUILDDIR }}
9292
run: make pythoninfo

.github/workflows/reusable-windows.yml

+11-9
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ name: Reusable Windows
33
on:
44
workflow_call:
55
inputs:
6+
os:
7+
description: OS to run on
8+
required: true
9+
type: string
610
arch:
711
description: CPU architecture
812
required: true
@@ -19,10 +23,8 @@ env:
1923
2024
jobs:
2125
build:
22-
name: >-
23-
build${{ inputs.arch != 'arm64' && ' and test' || '' }}
24-
(${{ inputs.arch }})
25-
runs-on: windows-latest
26+
name: 'build and test (${{ inputs.arch }})'
27+
runs-on: ${{ inputs.os }}
2628
timeout-minutes: 60
2729
steps:
2830
- uses: actions/checkout@v4
@@ -31,17 +33,17 @@ jobs:
3133
run: echo "::add-matcher::.github/problem-matchers/msvc.json"
3234
- name: Build CPython
3335
run: >-
34-
.\PCbuild\build.bat
36+
.\\PCbuild\\build.bat
3537
-e -d -v
3638
-p ${{ inputs.arch }}
3739
${{ fromJSON(inputs.free-threading) && '--disable-gil' || '' }}
38-
- name: Display build info
40+
- name: Display build info # FIXME(diegorusso): remove the `if`
3941
if: inputs.arch != 'arm64'
40-
run: .\python.bat -m test.pythoninfo
41-
- name: Tests
42+
run: .\\python.bat -m test.pythoninfo
43+
- name: Tests # FIXME(diegorusso): remove the `if`
4244
if: inputs.arch != 'arm64'
4345
run: >-
44-
.\PCbuild\rt.bat
46+
.\\PCbuild\\rt.bat
4547
-p ${{ inputs.arch }}
4648
-d -q --fast-ci
4749
${{ fromJSON(inputs.free-threading) && '--disable-gil' || '' }}

.pre-commit-config.yaml

+1-5
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,9 @@ repos:
5757
- id: check-github-workflows
5858

5959
- repo: https://github.com/rhysd/actionlint
60-
rev: v1.7.3
60+
rev: v1.7.4
6161
hooks:
6262
- id: actionlint
63-
args: [
64-
-ignore=1st argument of function call is not assignable,
65-
-ignore=SC2(015|038|086|091|097|098|129|155),
66-
]
6763

6864
- repo: https://github.com/sphinx-contrib/sphinx-lint
6965
rev: v1.0.0

Doc/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ check: _ensure-pre-commit
294294

295295
.PHONY: serve
296296
serve:
297-
@echo "The serve target was removed, use htmlview instead (see bpo-36329)"
297+
@echo "The serve target was removed, use htmllive instead (see gh-80510)"
298298

299299
# Targets for daily automated doc build
300300
# By default, Sphinx only rebuilds pages where the page content has changed.

Doc/c-api/init.rst

+3
Original file line numberDiff line numberDiff line change
@@ -1379,6 +1379,9 @@ All of the following functions must be called after :c:func:`Py_Initialize`.
13791379
This function now calls the :c:member:`PyThreadState.on_delete` callback.
13801380
Previously, that happened in :c:func:`PyThreadState_Delete`.
13811381
1382+
.. versionchanged:: 3.13
1383+
The :c:member:`PyThreadState.on_delete` callback was removed.
1384+
13821385
13831386
.. c:function:: void PyThreadState_Delete(PyThreadState *tstate)
13841387

Doc/c-api/long.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,7 @@ distinguished from a number. Use :c:func:`PyErr_Occurred` to disambiguate.
590590
return ``1`` when it's positive and ``0`` otherwise. Else set an
591591
exception and return ``-1``.
592592
593-
.. versionadded:: next
593+
.. versionadded:: 3.14
594594
595595
596596
.. c:function:: int PyLong_IsNegative(PyObject *obj)
@@ -601,7 +601,7 @@ distinguished from a number. Use :c:func:`PyErr_Occurred` to disambiguate.
601601
return ``1`` when it's negative and ``0`` otherwise. Else set an
602602
exception and return ``-1``.
603603
604-
.. versionadded:: next
604+
.. versionadded:: 3.14
605605
606606
607607
.. c:function:: int PyLong_IsZero(PyObject *obj)
@@ -612,7 +612,7 @@ distinguished from a number. Use :c:func:`PyErr_Occurred` to disambiguate.
612612
return ``1`` when it's zero and ``0`` otherwise. Else set an
613613
exception and return ``-1``.
614614
615-
.. versionadded:: next
615+
.. versionadded:: 3.14
616616
617617
618618
.. c:function:: PyObject* PyLong_GetInfo(void)

Doc/c-api/object.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -597,5 +597,5 @@ Object Protocol
597597
This function is intended to be used soon after *obj* is created,
598598
by the code that creates it.
599599
600-
.. versionadded:: next
600+
.. versionadded:: 3.14
601601

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

-4
Original file line numberDiff line numberDiff line change
@@ -145,10 +145,6 @@ although there is currently no date scheduled for their removal.
145145
* ``splitvalue()``
146146
* ``to_bytes()``
147147

148-
* :mod:`urllib.request`: :class:`~urllib.request.URLopener` and
149-
:class:`~urllib.request.FancyURLopener` style of invoking requests is
150-
deprecated. Use newer :func:`~urllib.request.urlopen` functions and methods.
151-
152148
* :mod:`wsgiref`: ``SimpleHandler.stdout.write()`` should not do partial
153149
writes.
154150

Doc/library/argparse.rst

+43-3
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,12 @@ arguments it contains. The default message can be overridden with the
192192
The ``%(prog)s`` format specifier is available to fill in the program name in
193193
your usage messages.
194194

195+
When a custom usage message is specified for the main parser, you may also want to
196+
consider passing the ``prog`` argument to :meth:`~ArgumentParser.add_subparsers`
197+
or the ``prog`` and the ``usage`` arguments to
198+
:meth:`~_SubParsersAction.add_parser`, to ensure consistent command prefixes and
199+
usage information across subparsers.
200+
195201

196202
.. _description:
197203

@@ -801,7 +807,8 @@ Only actions that consume command-line arguments (e.g. ``'store'``,
801807

802808
The recommended way to create a custom action is to extend :class:`Action`,
803809
overriding the :meth:`!__call__` method and optionally the :meth:`!__init__` and
804-
:meth:`!format_usage` methods.
810+
:meth:`!format_usage` methods. You can also register custom actions using the
811+
:meth:`~ArgumentParser.register` method and reference them by their registered name.
805812

806813
An example of a custom action::
807814

@@ -1020,10 +1027,11 @@ necessary type-checking and type conversions to be performed.
10201027
If the type_ keyword is used with the default_ keyword, the type converter
10211028
is only applied if the default is a string.
10221029

1023-
The argument to ``type`` can be any callable that accepts a single string.
1030+
The argument to ``type`` can be a callable that accepts a single string or
1031+
the name of a registered type (see :meth:`~ArgumentParser.register`)
10241032
If the function raises :exc:`ArgumentTypeError`, :exc:`TypeError`, or
10251033
:exc:`ValueError`, the exception is caught and a nicely formatted error
1026-
message is displayed. No other exception types are handled.
1034+
message is displayed. Other exception types are not handled.
10271035

10281036
Common built-in types and functions can be used as type converters:
10291037

@@ -1808,6 +1816,10 @@ Sub-commands
18081816
.. versionchanged:: 3.7
18091817
New *required* keyword-only parameter.
18101818

1819+
.. versionchanged:: 3.14
1820+
Subparser's *prog* is no longer affected by a custom usage message in
1821+
the main parser.
1822+
18111823

18121824
FileType objects
18131825
^^^^^^^^^^^^^^^^
@@ -2163,6 +2175,34 @@ Intermixed parsing
21632175
.. versionadded:: 3.7
21642176

21652177

2178+
Registering custom types or actions
2179+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2180+
2181+
.. method:: ArgumentParser.register(registry_name, value, object)
2182+
2183+
Sometimes it's desirable to use a custom string in error messages to provide
2184+
more user-friendly output. In these cases, :meth:`!register` can be used to
2185+
register custom actions or types with a parser and allow you to reference the
2186+
type by their registered name instead of their callable name.
2187+
2188+
The :meth:`!register` method accepts three arguments - a *registry_name*,
2189+
specifying the internal registry where the object will be stored (e.g.,
2190+
``action``, ``type``), *value*, which is the key under which the object will
2191+
be registered, and object, the callable to be registered.
2192+
2193+
The following example shows how to register a custom type with a parser::
2194+
2195+
>>> import argparse
2196+
>>> parser = argparse.ArgumentParser()
2197+
>>> parser.register('type', 'hexadecimal integer', lambda s: int(s, 16))
2198+
>>> parser.add_argument('--foo', type='hexadecimal integer')
2199+
_StoreAction(option_strings=['--foo'], dest='foo', nargs=None, const=None, default=None, type='hexadecimal integer', choices=None, required=False, help=None, metavar=None, deprecated=False)
2200+
>>> parser.parse_args(['--foo', '0xFA'])
2201+
Namespace(foo=250)
2202+
>>> parser.parse_args(['--foo', '1.2'])
2203+
usage: PROG [-h] [--foo FOO]
2204+
PROG: error: argument --foo: invalid 'hexadecimal integer' value: '1.2'
2205+
21662206
Exceptions
21672207
----------
21682208

Doc/library/concurrent.futures.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -690,7 +690,7 @@ Exception classes
690690
of a :class:`~concurrent.futures.InterpreterPoolExecutor`
691691
has failed initializing.
692692

693-
.. versionadded:: next
693+
.. versionadded:: 3.14
694694

695695
.. exception:: ExecutionFailed
696696

@@ -699,7 +699,7 @@ Exception classes
699699
:meth:`~concurrent.futures.Executor.submit` when there's an uncaught
700700
exception from the submitted task.
701701

702-
.. versionadded:: next
702+
.. versionadded:: 3.14
703703

704704
.. currentmodule:: concurrent.futures.process
705705

0 commit comments

Comments
 (0)