Skip to content

Commit 17556c0

Browse files
Merge branch 'main' into pythongh-127133
2 parents 76aadc6 + a13e94d commit 17556c0

File tree

64 files changed

+1360
-592
lines changed

Some content is hidden

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

64 files changed

+1360
-592
lines changed

.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

+17-5
Original file line numberDiff line numberDiff line change
@@ -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/library/argparse.rst

+18
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

@@ -583,6 +589,14 @@ are strings::
583589
>>> parser.parse_args(['--action', 'sumn', 1, 2, 3])
584590
tester.py: error: argument --action: invalid choice: 'sumn', maybe you meant 'sum'? (choose from 'sum', 'max')
585591

592+
If you're writing code that needs to be compatible with older Python versions
593+
and want to opportunistically use ``suggest_on_error`` when it's available, you
594+
can set it as an attribute after initializing the parser instead of using the
595+
keyword argument::
596+
597+
>>> parser = argparse.ArgumentParser(description='Process some integers.')
598+
>>> parser.suggest_on_error = True
599+
586600
.. versionadded:: 3.14
587601

588602

@@ -1810,6 +1824,10 @@ Sub-commands
18101824
.. versionchanged:: 3.7
18111825
New *required* keyword-only parameter.
18121826

1827+
.. versionchanged:: 3.14
1828+
Subparser's *prog* is no longer affected by a custom usage message in
1829+
the main parser.
1830+
18131831

18141832
FileType objects
18151833
^^^^^^^^^^^^^^^^

Doc/library/ctypes.rst

+48-15
Original file line numberDiff line numberDiff line change
@@ -1413,13 +1413,15 @@ way is to instantiate one of the following classes:
14131413

14141414
.. class:: OleDLL(name, mode=DEFAULT_MODE, handle=None, use_errno=False, use_last_error=False, winmode=None)
14151415

1416-
Windows only: Instances of this class represent loaded shared libraries,
1416+
Instances of this class represent loaded shared libraries,
14171417
functions in these libraries use the ``stdcall`` calling convention, and are
14181418
assumed to return the windows specific :class:`HRESULT` code. :class:`HRESULT`
14191419
values contain information specifying whether the function call failed or
14201420
succeeded, together with additional error code. If the return value signals a
14211421
failure, an :class:`OSError` is automatically raised.
14221422

1423+
.. availability:: Windows
1424+
14231425
.. versionchanged:: 3.3
14241426
:exc:`WindowsError` used to be raised,
14251427
which is now an alias of :exc:`OSError`.
@@ -1431,14 +1433,17 @@ way is to instantiate one of the following classes:
14311433

14321434
.. class:: WinDLL(name, mode=DEFAULT_MODE, handle=None, use_errno=False, use_last_error=False, winmode=None)
14331435

1434-
Windows only: Instances of this class represent loaded shared libraries,
1436+
Instances of this class represent loaded shared libraries,
14351437
functions in these libraries use the ``stdcall`` calling convention, and are
14361438
assumed to return :c:expr:`int` by default.
14371439

1440+
.. availability:: Windows
1441+
14381442
.. versionchanged:: 3.12
14391443

14401444
The *name* parameter can now be a :term:`path-like object`.
14411445

1446+
14421447
The Python :term:`global interpreter lock` is released before calling any
14431448
function exported by these libraries, and reacquired afterwards.
14441449

@@ -1574,13 +1579,17 @@ These prefabricated library loaders are available:
15741579
.. data:: windll
15751580
:noindex:
15761581

1577-
Windows only: Creates :class:`WinDLL` instances.
1582+
Creates :class:`WinDLL` instances.
1583+
1584+
.. availability:: Windows
15781585

15791586

15801587
.. data:: oledll
15811588
:noindex:
15821589

1583-
Windows only: Creates :class:`OleDLL` instances.
1590+
Creates :class:`OleDLL` instances.
1591+
1592+
.. availability:: Windows
15841593

15851594

15861595
.. data:: pydll
@@ -1746,11 +1755,13 @@ See :ref:`ctypes-callback-functions` for examples.
17461755

17471756
.. function:: WINFUNCTYPE(restype, *argtypes, use_errno=False, use_last_error=False)
17481757

1749-
Windows only: The returned function prototype creates functions that use the
1758+
The returned function prototype creates functions that use the
17501759
``stdcall`` calling convention. The function will
17511760
release the GIL during the call. *use_errno* and *use_last_error* have the
17521761
same meaning as above.
17531762

1763+
.. availability:: Windows
1764+
17541765

17551766
.. function:: PYFUNCTYPE(restype, *argtypes)
17561767

@@ -1981,17 +1992,21 @@ Utility functions
19811992

19821993
.. function:: DllCanUnloadNow()
19831994

1984-
Windows only: This function is a hook which allows implementing in-process
1995+
This function is a hook which allows implementing in-process
19851996
COM servers with ctypes. It is called from the DllCanUnloadNow function that
19861997
the _ctypes extension dll exports.
19871998

1999+
.. availability:: Windows
2000+
19882001

19892002
.. function:: DllGetClassObject()
19902003

1991-
Windows only: This function is a hook which allows implementing in-process
2004+
This function is a hook which allows implementing in-process
19922005
COM servers with ctypes. It is called from the DllGetClassObject function
19932006
that the ``_ctypes`` extension dll exports.
19942007

2008+
.. availability:: Windows
2009+
19952010

19962011
.. function:: find_library(name)
19972012
:module: ctypes.util
@@ -2007,28 +2022,35 @@ Utility functions
20072022
.. function:: find_msvcrt()
20082023
:module: ctypes.util
20092024

2010-
Windows only: return the filename of the VC runtime library used by Python,
2025+
Returns the filename of the VC runtime library used by Python,
20112026
and by the extension modules. If the name of the library cannot be
20122027
determined, ``None`` is returned.
20132028

20142029
If you need to free memory, for example, allocated by an extension module
20152030
with a call to the ``free(void *)``, it is important that you use the
20162031
function in the same library that allocated the memory.
20172032

2033+
.. availability:: Windows
2034+
20182035

20192036
.. function:: FormatError([code])
20202037

2021-
Windows only: Returns a textual description of the error code *code*. If no
2038+
Returns a textual description of the error code *code*. If no
20222039
error code is specified, the last error code is used by calling the Windows
20232040
api function GetLastError.
20242041

2042+
.. availability:: Windows
2043+
20252044

20262045
.. function:: GetLastError()
20272046

2028-
Windows only: Returns the last error code set by Windows in the calling thread.
2047+
Returns the last error code set by Windows in the calling thread.
20292048
This function calls the Windows ``GetLastError()`` function directly,
20302049
it does not return the ctypes-private copy of the error code.
20312050

2051+
.. availability:: Windows
2052+
2053+
20322054
.. function:: get_errno()
20332055

20342056
Returns the current value of the ctypes-private copy of the system
@@ -2038,11 +2060,14 @@ Utility functions
20382060

20392061
.. function:: get_last_error()
20402062

2041-
Windows only: returns the current value of the ctypes-private copy of the system
2063+
Returns the current value of the ctypes-private copy of the system
20422064
:data:`!LastError` variable in the calling thread.
20432065

2066+
.. availability:: Windows
2067+
20442068
.. audit-event:: ctypes.get_last_error "" ctypes.get_last_error
20452069

2070+
20462071
.. function:: memmove(dst, src, count)
20472072

20482073
Same as the standard C memmove library function: copies *count* bytes from
@@ -2091,10 +2116,12 @@ Utility functions
20912116

20922117
.. function:: set_last_error(value)
20932118

2094-
Windows only: set the current value of the ctypes-private copy of the system
2119+
Sets the current value of the ctypes-private copy of the system
20952120
:data:`!LastError` variable in the calling thread to *value* and return the
20962121
previous value.
20972122

2123+
.. availability:: Windows
2124+
20982125
.. audit-event:: ctypes.set_last_error error ctypes.set_last_error
20992126

21002127

@@ -2115,12 +2142,14 @@ Utility functions
21152142

21162143
.. function:: WinError(code=None, descr=None)
21172144

2118-
Windows only: this function is probably the worst-named thing in ctypes. It
2145+
This function is probably the worst-named thing in ctypes. It
21192146
creates an instance of :exc:`OSError`. If *code* is not specified,
21202147
``GetLastError`` is called to determine the error code. If *descr* is not
21212148
specified, :func:`FormatError` is called to get a textual description of the
21222149
error.
21232150

2151+
.. availability:: Windows
2152+
21242153
.. versionchanged:: 3.3
21252154
An instance of :exc:`WindowsError` used to be created, which is now an
21262155
alias of :exc:`OSError`.
@@ -2484,9 +2513,11 @@ These are the fundamental ctypes data types:
24842513

24852514
.. class:: HRESULT
24862515

2487-
Windows only: Represents a :c:type:`!HRESULT` value, which contains success or
2516+
Represents a :c:type:`!HRESULT` value, which contains success or
24882517
error information for a function or method call.
24892518

2519+
.. availability:: Windows
2520+
24902521

24912522
.. class:: py_object
24922523

@@ -2755,7 +2786,7 @@ Exceptions
27552786

27562787
.. exception:: COMError(hresult, text, details)
27572788

2758-
Windows only: This exception is raised when a COM method call failed.
2789+
This exception is raised when a COM method call failed.
27592790

27602791
.. attribute:: hresult
27612792

@@ -2775,4 +2806,6 @@ Exceptions
27752806
identifier. *progid* is the ``ProgID`` of the interface that defined the
27762807
error.
27772808

2809+
.. availability:: Windows
2810+
27782811
.. versionadded:: next

Doc/library/importlib.metadata.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ Entry points
133133

134134
Details of a collection of installed entry points.
135135

136-
Also provides a ``.groups`` attribute that reports all identifed entry
136+
Also provides a ``.groups`` attribute that reports all identified entry
137137
point groups, and a ``.names`` attribute that reports all identified entry
138138
point names.
139139

0 commit comments

Comments
 (0)