Skip to content

Commit 750c33b

Browse files
Merge branch 'main' into gh-142889
2 parents 4210757 + c75d220 commit 750c33b

File tree

78 files changed

+4622
-1932
lines changed

Some content is hidden

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

78 files changed

+4622
-1932
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,3 +112,4 @@ Tools/peg_generator/pegen/grammar_parser.py generated
112112
aclocal.m4 generated
113113
configure generated
114114
*.min.js generated
115+
package-lock.json generated

.github/actionlint.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
self-hosted-runner:
2+
# Pending release of actionlint > 1.7.11 for macos-26-intel support
3+
# https://github.com/rhysd/actionlint/pull/629
4+
labels: ["macos-26-intel"]
5+
16
config-variables: null
27

38
paths:

.github/workflows/build.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -198,16 +198,16 @@ jobs:
198198
strategy:
199199
fail-fast: false
200200
matrix:
201-
# macos-14 is M1, macos-15-intel is Intel.
202-
# macos-15-intel only runs tests against the GIL-enabled CPython.
201+
# macos-26 is Apple Silicon, macos-26-intel is Intel.
202+
# macos-26-intel only runs tests against the GIL-enabled CPython.
203203
os:
204-
- macos-14
205-
- macos-15-intel
204+
- macos-26
205+
- macos-26-intel
206206
free-threading:
207207
- false
208208
- true
209209
exclude:
210-
- os: macos-15-intel
210+
- os: macos-26-intel
211211
free-threading: true
212212
uses: ./.github/workflows/reusable-macos.yml
213213
with:
@@ -336,7 +336,7 @@ jobs:
336336
matrix:
337337
include:
338338
- arch: aarch64
339-
runs-on: macos-14
339+
runs-on: macos-26
340340
- arch: x86_64
341341
runs-on: ubuntu-24.04
342342

.github/workflows/jit.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,9 @@ jobs:
9999
- false
100100
include:
101101
- target: x86_64-apple-darwin/clang
102-
runner: macos-15-intel
102+
runner: macos-26-intel
103103
- target: aarch64-apple-darwin/clang
104-
runner: macos-14
104+
runner: macos-26
105105
steps:
106106
- uses: actions/checkout@v6
107107
with:

.github/workflows/reusable-macos.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,15 @@ jobs:
5252
--prefix=/opt/python-dev \
5353
--with-openssl="$(brew --prefix openssl@3.5)"
5454
- name: Build CPython
55-
if : ${{ inputs.free-threading || inputs.os != 'macos-15-intel' }}
55+
if : ${{ inputs.free-threading || inputs.os != 'macos-26-intel' }}
5656
run: gmake -j8
5757
- name: Build CPython for compiler warning check
58-
if : ${{ !inputs.free-threading && inputs.os == 'macos-15-intel' }}
58+
if : ${{ !inputs.free-threading && inputs.os == 'macos-26-intel' }}
5959
run: set -o pipefail; gmake -j8 --output-sync 2>&1 | tee compiler_output_macos.txt
6060
- name: Display build info
6161
run: make pythoninfo
6262
- name: Check compiler warnings
63-
if : ${{ !inputs.free-threading && inputs.os == 'macos-15-intel' }}
63+
if : ${{ !inputs.free-threading && inputs.os == 'macos-26-intel' }}
6464
run: >-
6565
python3 Tools/build/check_warnings.py
6666
--compiler-output-file-path=compiler_output_macos.txt

.github/workflows/tail-call.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ jobs:
6767
matrix:
6868
include:
6969
- target: x86_64-apple-darwin/clang
70-
runner: macos-15-intel
70+
runner: macos-26-intel
7171
- target: aarch64-apple-darwin/clang
72-
runner: macos-14
72+
runner: macos-26
7373
steps:
7474
- uses: actions/checkout@v6
7575
with:

Android/android.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,8 @@ async def gradle_task(context):
628628
# Randomization is disabled because order-dependent failures are
629629
# much less likely to pass on a rerun in single-process mode.
630630
"-m", "test",
631-
f"--{context.ci_mode}-ci", "--single-process", "--no-randomize"
631+
f"--{context.ci_mode}-ci", "--single-process", "--no-randomize",
632+
"--pythoninfo",
632633
]
633634

634635
if not any(arg in context.args for arg in ["-c", "-m"]):

Apple/__main__.py

Lines changed: 45 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,11 @@ def all_host_triples(platform: str) -> list[str]:
173173
return triples
174174

175175

176-
def clean(context: argparse.Namespace, target: str = "all") -> None:
176+
def clean(context: argparse.Namespace, target: str | None = None) -> None:
177177
"""The implementation of the "clean" command."""
178+
if target is None:
179+
target = context.host
180+
178181
# If we're explicitly targeting the build, there's no platform or
179182
# distribution artefacts. If we're cleaning tests, we keep all built
180183
# artefacts. Otherwise, the built artefacts must be dirty, so we remove
@@ -377,7 +380,12 @@ def configure_host_python(
377380
with group(f"Downloading dependencies ({host})"):
378381
if not prefix_dir.exists():
379382
prefix_dir.mkdir()
380-
unpack_deps(context.platform, host, prefix_dir, context.cache_dir)
383+
cache_dir = (
384+
Path(context.cache_dir).resolve()
385+
if context.cache_dir
386+
else CROSS_BUILD_DIR / "downloads"
387+
)
388+
unpack_deps(context.platform, host, prefix_dir, cache_dir)
381389
else:
382390
print("Dependencies already installed")
383391

@@ -828,9 +836,10 @@ def test(context: argparse.Namespace, host: str | None = None) -> None: # noqa:
828836
+ [
829837
"--",
830838
"test",
831-
f"--{context.ci_mode}-ci",
839+
f"--{context.ci_mode or 'fast'}-ci",
832840
"--single-process",
833841
"--no-randomize",
842+
"--pythoninfo",
834843
# Timeout handling requires subprocesses; explicitly setting
835844
# the timeout to -1 disables the faulthandler.
836845
"--timeout=-1",
@@ -894,7 +903,7 @@ def parse_args() -> argparse.Namespace:
894903
configure_build = subcommands.add_parser(
895904
"configure-build", help="Run `configure` for the build Python"
896905
)
897-
subcommands.add_parser(
906+
make_build = subcommands.add_parser(
898907
"make-build", help="Run `make` for the build Python"
899908
)
900909
configure_host = subcommands.add_parser(
@@ -950,6 +959,31 @@ def parse_args() -> argparse.Namespace:
950959
),
951960
)
952961

962+
# --cross-build-dir argument
963+
for cmd in [
964+
clean,
965+
configure_build,
966+
make_build,
967+
configure_host,
968+
make_host,
969+
build,
970+
package,
971+
test,
972+
ci,
973+
]:
974+
cmd.add_argument(
975+
"--cross-build-dir",
976+
action="store",
977+
default=os.environ.get("CROSS_BUILD_DIR"),
978+
dest="cross_build_dir",
979+
type=Path,
980+
help=(
981+
"Path to the cross-build directory "
982+
f"(default: {CROSS_BUILD_DIR}). Can also be set "
983+
"with the CROSS_BUILD_DIR environment variable."
984+
),
985+
)
986+
953987
# --clean option
954988
for cmd in [configure_build, configure_host, build, package, test, ci]:
955989
cmd.add_argument(
@@ -964,7 +998,7 @@ def parse_args() -> argparse.Namespace:
964998
for cmd in [configure_host, build, ci]:
965999
cmd.add_argument(
9661000
"--cache-dir",
967-
default="./cross-build/downloads",
1001+
default=os.environ.get("CACHE_DIR"),
9681002
help="The directory to store cached downloads.",
9691003
)
9701004

@@ -1031,6 +1065,12 @@ def signal_handler(*args):
10311065

10321066
# Process command line arguments
10331067
context = parse_args()
1068+
1069+
# Set the CROSS_BUILD_DIR if an argument was provided
1070+
if context.cross_build_dir:
1071+
global CROSS_BUILD_DIR
1072+
CROSS_BUILD_DIR = context.cross_build_dir.resolve()
1073+
10341074
dispatch: dict[str, Callable] = {
10351075
"clean": clean,
10361076
"configure-build": configure_build_python,

Doc/library/array.rst

Lines changed: 37 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
--------------
1010

1111
This module defines an object type which can compactly represent an array of
12-
basic values: characters, integers, floating-point numbers. Arrays are mutable :term:`sequence`
12+
basic values: characters, integers, floating-point numbers, complex numbers. Arrays are mutable :term:`sequence`
1313
types and behave very much like lists, except that the type of objects stored in
1414
them is constrained. The type is specified at object creation time by using a
1515
:dfn:`type code`, which is a single character. The following type codes are
@@ -46,6 +46,11 @@ defined:
4646
+-----------+--------------------+-------------------+-----------------------+-------+
4747
| ``'d'`` | double | float | 8 | |
4848
+-----------+--------------------+-------------------+-----------------------+-------+
49+
| ``'F'`` | float complex | complex | 8 | \(3) |
50+
+-----------+--------------------+-------------------+-----------------------+-------+
51+
| ``'D'`` | double complex | complex | 16 | \(3) |
52+
+-----------+--------------------+-------------------+-----------------------+-------+
53+
4954

5055
Notes:
5156

@@ -63,6 +68,15 @@ Notes:
6368
(2)
6469
.. versionadded:: 3.13
6570

71+
(3)
72+
Complex types (``F`` and ``D``) are available unconditionally,
73+
regardless on support for complex types (the Annex G of the C11 standard)
74+
by the C compiler.
75+
As specified in the C11 standard, each complex type is represented by a
76+
two-element C array containing, respectively, the real and imaginary parts.
77+
78+
.. versionadded:: 3.15
79+
6680
.. seealso::
6781

6882
The :ref:`ctypes <ctypes-fundamental-data-types>` and
@@ -119,9 +133,9 @@ The module defines the following type:
119133
The length in bytes of one array item in the internal representation.
120134

121135

122-
.. method:: append(x)
136+
.. method:: append(value, /)
123137

124-
Append a new item with value *x* to the end of the array.
138+
Append a new item with the specified value to the end of the array.
125139

126140

127141
.. method:: buffer_info()
@@ -146,25 +160,26 @@ The module defines the following type:
146160
.. method:: byteswap()
147161

148162
"Byteswap" all items of the array. This is only supported for values which are
149-
1, 2, 4, or 8 bytes in size; for other types of values, :exc:`RuntimeError` is
163+
1, 2, 4, 8 or 16 bytes in size; for other types of values, :exc:`RuntimeError` is
150164
raised. It is useful when reading data from a file written on a machine with a
151-
different byte order.
165+
different byte order. Note, that for complex types the order of
166+
components (the real part, followed by imaginary part) is preserved.
152167

153168

154-
.. method:: count(x)
169+
.. method:: count(value, /)
155170

156-
Return the number of occurrences of *x* in the array.
171+
Return the number of occurrences of *value* in the array.
157172

158173

159-
.. method:: extend(iterable)
174+
.. method:: extend(iterable, /)
160175

161176
Append items from *iterable* to the end of the array. If *iterable* is another
162177
array, it must have *exactly* the same type code; if not, :exc:`TypeError` will
163178
be raised. If *iterable* is not an array, it must be iterable and its elements
164179
must be the right type to be appended to the array.
165180

166181

167-
.. method:: frombytes(buffer)
182+
.. method:: frombytes(buffer, /)
168183

169184
Appends items from the :term:`bytes-like object`, interpreting
170185
its content as an array of machine values (as if it had been read
@@ -174,55 +189,55 @@ The module defines the following type:
174189
:meth:`!fromstring` is renamed to :meth:`frombytes` for clarity.
175190

176191

177-
.. method:: fromfile(f, n)
192+
.. method:: fromfile(f, n, /)
178193

179194
Read *n* items (as machine values) from the :term:`file object` *f* and append
180195
them to the end of the array. If less than *n* items are available,
181196
:exc:`EOFError` is raised, but the items that were available are still
182197
inserted into the array.
183198

184199

185-
.. method:: fromlist(list)
200+
.. method:: fromlist(list, /)
186201

187202
Append items from the list. This is equivalent to ``for x in list:
188203
a.append(x)`` except that if there is a type error, the array is unchanged.
189204

190205

191-
.. method:: fromunicode(s)
206+
.. method:: fromunicode(ustr, /)
192207

193208
Extends this array with data from the given Unicode string.
194209
The array must have type code ``'u'`` or ``'w'``; otherwise a :exc:`ValueError` is raised.
195210
Use ``array.frombytes(unicodestring.encode(enc))`` to append Unicode data to an
196211
array of some other type.
197212

198213

199-
.. method:: index(x[, start[, stop]])
214+
.. method:: index(value[, start[, stop]])
200215

201216
Return the smallest *i* such that *i* is the index of the first occurrence of
202-
*x* in the array. The optional arguments *start* and *stop* can be
203-
specified to search for *x* within a subsection of the array. Raise
204-
:exc:`ValueError` if *x* is not found.
217+
*value* in the array. The optional arguments *start* and *stop* can be
218+
specified to search for *value* within a subsection of the array. Raise
219+
:exc:`ValueError` if *value* is not found.
205220

206221
.. versionchanged:: 3.10
207222
Added optional *start* and *stop* parameters.
208223

209224

210-
.. method:: insert(i, x)
225+
.. method:: insert(index, value, /)
211226

212-
Insert a new item with value *x* in the array before position *i*. Negative
227+
Insert a new item *value* in the array before position *index*. Negative
213228
values are treated as being relative to the end of the array.
214229

215230

216-
.. method:: pop([i])
231+
.. method:: pop(index=-1, /)
217232

218233
Removes the item with the index *i* from the array and returns it. The optional
219234
argument defaults to ``-1``, so that by default the last item is removed and
220235
returned.
221236

222237

223-
.. method:: remove(x)
238+
.. method:: remove(value, /)
224239

225-
Remove the first occurrence of *x* from the array.
240+
Remove the first occurrence of *value* from the array.
226241

227242

228243
.. method:: clear()
@@ -247,7 +262,7 @@ The module defines the following type:
247262
:meth:`!tostring` is renamed to :meth:`tobytes` for clarity.
248263

249264

250-
.. method:: tofile(f)
265+
.. method:: tofile(f, /)
251266

252267
Write all items (as machine values) to the :term:`file object` *f*.
253268

0 commit comments

Comments
 (0)