Skip to content

Commit 643ac9c

Browse files
Merge branch '3.13' into backport-1a7824a-3.13
2 parents 9345940 + dc12380 commit 643ac9c

File tree

79 files changed

+1105
-450
lines changed

Some content is hidden

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

79 files changed

+1105
-450
lines changed

.github/workflows/build.yml

Lines changed: 18 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ jobs:
244244
macOS
245245
${{ fromJSON(matrix.free-threading) && '(free-threading)' || '' }}
246246
needs: build-context
247-
if: needs.build-context.outputs.run-tests == 'true'
247+
if: needs.build-context.outputs.run-macos == 'true'
248248
strategy:
249249
fail-fast: false
250250
matrix:
@@ -269,7 +269,7 @@ jobs:
269269
Ubuntu
270270
${{ fromJSON(matrix.free-threading) && '(free-threading)' || '' }}
271271
needs: build-context
272-
if: needs.build-context.outputs.run-tests == 'true'
272+
if: needs.build-context.outputs.run-ubuntu == 'true'
273273
strategy:
274274
fail-fast: false
275275
matrix:
@@ -285,7 +285,7 @@ jobs:
285285
runs-on: ${{ matrix.os }}
286286
timeout-minutes: 60
287287
needs: build-context
288-
if: needs.build-context.outputs.run-tests == 'true'
288+
if: needs.build-context.outputs.run-ubuntu == 'true'
289289
strategy:
290290
fail-fast: false
291291
matrix:
@@ -338,7 +338,7 @@ jobs:
338338
build-android:
339339
name: Android (${{ matrix.arch }})
340340
needs: build-context
341-
if: needs.build-context.outputs.run-tests == 'true'
341+
if: needs.build-context.outputs.run-android == 'true'
342342
timeout-minutes: 60
343343
strategy:
344344
fail-fast: false
@@ -360,15 +360,15 @@ jobs:
360360
build-wasi:
361361
name: 'WASI'
362362
needs: build-context
363-
if: needs.build-context.outputs.run-tests == 'true'
363+
if: needs.build-context.outputs.run-wasi == 'true'
364364
uses: ./.github/workflows/reusable-wasi.yml
365365

366366
test-hypothesis:
367367
name: "Hypothesis tests on Ubuntu"
368368
runs-on: ubuntu-24.04
369369
timeout-minutes: 60
370370
needs: build-context
371-
if: needs.build-context.outputs.run-tests == 'true'
371+
if: needs.build-context.outputs.run-ubuntu == 'true'
372372
env:
373373
OPENSSL_VER: 3.0.18
374374
PYTHONSTRICTEXTENSIONBUILD: 1
@@ -474,7 +474,7 @@ jobs:
474474
runs-on: ${{ matrix.os }}
475475
timeout-minutes: 60
476476
needs: build-context
477-
if: needs.build-context.outputs.run-tests == 'true'
477+
if: needs.build-context.outputs.run-ubuntu == 'true'
478478
strategy:
479479
fail-fast: false
480480
matrix:
@@ -527,7 +527,7 @@ jobs:
527527
# ${{ '' } is a hack to nest jobs under the same sidebar category.
528528
name: Sanitizers${{ '' }} # zizmor: ignore[obfuscation]
529529
needs: build-context
530-
if: needs.build-context.outputs.run-tests == 'true'
530+
if: needs.build-context.outputs.run-ubuntu == 'true'
531531
strategy:
532532
fail-fast: false
533533
matrix:
@@ -615,41 +615,29 @@ jobs:
615615
test-hypothesis,
616616
cifuzz,
617617
allowed-skips: >-
618+
${{ !fromJSON(needs.build-context.outputs.run-docs) && 'check-docs,' || '' }}
618619
${{
619-
!fromJSON(needs.build-context.outputs.run-docs)
620+
needs.build-context.outputs.run-tests != 'true'
620621
&& '
621-
check-docs,
622+
check-autoconf-regen,
623+
check-generated-files,
622624
'
623625
|| ''
624626
}}
627+
${{ !fromJSON(needs.build-context.outputs.run-windows-tests) && 'build-windows,' || '' }}
628+
${{ !fromJSON(needs.build-context.outputs.run-ci-fuzz) && 'cifuzz,' || '' }}
629+
${{ !fromJSON(needs.build-context.outputs.run-macos) && 'build-macos,' || '' }}
625630
${{
626-
needs.build-context.outputs.run-tests != 'true'
631+
!fromJSON(needs.build-context.outputs.run-ubuntu)
627632
&& '
628-
check-autoconf-regen,
629-
check-generated-files,
630-
build-macos,
631633
build-ubuntu,
632634
build-ubuntu-ssltests,
633-
build-android,
634-
build-wasi,
635635
test-hypothesis,
636636
build-asan,
637637
build-san,
638638
'
639639
|| ''
640640
}}
641-
${{
642-
!fromJSON(needs.build-context.outputs.run-windows-tests)
643-
&& '
644-
build-windows,
645-
'
646-
|| ''
647-
}}
648-
${{
649-
!fromJSON(needs.build-context.outputs.run-ci-fuzz)
650-
&& '
651-
cifuzz,
652-
'
653-
|| ''
654-
}}
641+
${{ !fromJSON(needs.build-context.outputs.run-android) && 'build-android,' || '' }}
642+
${{ !fromJSON(needs.build-context.outputs.run-wasi) && 'build-wasi,' || '' }}
655643
jobs: ${{ toJSON(needs) }}

.github/workflows/reusable-context.yml

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,31 +17,47 @@ on: # yamllint disable-line rule:truthy
1717
# || 'falsy-branch'
1818
# }}
1919
#
20+
run-android:
21+
description: Whether to run the Android tests
22+
value: ${{ jobs.compute-changes.outputs.run-android }} # bool
23+
run-ci-fuzz:
24+
description: Whether to run the CIFuzz job
25+
value: ${{ jobs.compute-changes.outputs.run-ci-fuzz }} # bool
2026
run-docs:
2127
description: Whether to build the docs
2228
value: ${{ jobs.compute-changes.outputs.run-docs }} # bool
29+
run-macos:
30+
description: Whether to run the macOS tests
31+
value: ${{ jobs.compute-changes.outputs.run-macos }} # bool
2332
run-tests:
2433
description: Whether to run the regular tests
2534
value: ${{ jobs.compute-changes.outputs.run-tests }} # bool
26-
run-windows-tests:
27-
description: Whether to run the Windows tests
28-
value: ${{ jobs.compute-changes.outputs.run-windows-tests }} # bool
35+
run-ubuntu:
36+
description: Whether to run the Ubuntu tests
37+
value: ${{ jobs.compute-changes.outputs.run-ubuntu }} # bool
38+
run-wasi:
39+
description: Whether to run the WASI tests
40+
value: ${{ jobs.compute-changes.outputs.run-wasi }} # bool
2941
run-windows-msi:
3042
description: Whether to run the MSI installer smoke tests
3143
value: ${{ jobs.compute-changes.outputs.run-windows-msi }} # bool
32-
run-ci-fuzz:
33-
description: Whether to run the CIFuzz job
34-
value: ${{ jobs.compute-changes.outputs.run-ci-fuzz }} # bool
44+
run-windows-tests:
45+
description: Whether to run the Windows tests
46+
value: ${{ jobs.compute-changes.outputs.run-windows-tests }} # bool
3547

3648
jobs:
3749
compute-changes:
3850
name: Create context from changed files
3951
runs-on: ubuntu-latest
4052
timeout-minutes: 10
4153
outputs:
54+
run-android: ${{ steps.changes.outputs.run-android }}
4255
run-ci-fuzz: ${{ steps.changes.outputs.run-ci-fuzz }}
4356
run-docs: ${{ steps.changes.outputs.run-docs }}
57+
run-macos: ${{ steps.changes.outputs.run-macos }}
4458
run-tests: ${{ steps.changes.outputs.run-tests }}
59+
run-ubuntu: ${{ steps.changes.outputs.run-ubuntu }}
60+
run-wasi: ${{ steps.changes.outputs.run-wasi }}
4561
run-windows-msi: ${{ steps.changes.outputs.run-windows-msi }}
4662
run-windows-tests: ${{ steps.changes.outputs.run-windows-tests }}
4763
steps:

Android/android.py

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
ANDROID_DIR.name == "Android" and (PYTHON_DIR / "pyconfig.h.in").exists()
3030
)
3131

32+
ENV_SCRIPT = ANDROID_DIR / "android-env.sh"
3233
TESTBED_DIR = ANDROID_DIR / "testbed"
3334
CROSS_BUILD_DIR = PYTHON_DIR / "cross-build"
3435

@@ -129,12 +130,11 @@ def android_env(host):
129130
sysconfig_filename = next(sysconfig_files).name
130131
host = re.fullmatch(r"_sysconfigdata__android_(.+).py", sysconfig_filename)[1]
131132

132-
env_script = ANDROID_DIR / "android-env.sh"
133133
env_output = subprocess.run(
134134
f"set -eu; "
135135
f"HOST={host}; "
136136
f"PREFIX={prefix}; "
137-
f". {env_script}; "
137+
f". {ENV_SCRIPT}; "
138138
f"export",
139139
check=True, shell=True, capture_output=True, encoding='utf-8',
140140
).stdout
@@ -151,7 +151,7 @@ def android_env(host):
151151
env[key] = value
152152

153153
if not env:
154-
raise ValueError(f"Found no variables in {env_script.name} output:\n"
154+
raise ValueError(f"Found no variables in {ENV_SCRIPT.name} output:\n"
155155
+ env_output)
156156
return env
157157

@@ -281,15 +281,30 @@ def clean_all(context):
281281

282282

283283
def setup_ci():
284-
# https://github.blog/changelog/2024-04-02-github-actions-hardware-accelerated-android-virtualization-now-available/
285-
if "GITHUB_ACTIONS" in os.environ and platform.system() == "Linux":
286-
run(
287-
["sudo", "tee", "/etc/udev/rules.d/99-kvm4all.rules"],
288-
input='KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"\n',
289-
text=True,
290-
)
291-
run(["sudo", "udevadm", "control", "--reload-rules"])
292-
run(["sudo", "udevadm", "trigger", "--name-match=kvm"])
284+
if "GITHUB_ACTIONS" in os.environ:
285+
# Enable emulator hardware acceleration
286+
# (https://github.blog/changelog/2024-04-02-github-actions-hardware-accelerated-android-virtualization-now-available/).
287+
if platform.system() == "Linux":
288+
run(
289+
["sudo", "tee", "/etc/udev/rules.d/99-kvm4all.rules"],
290+
input='KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"\n',
291+
text=True,
292+
)
293+
run(["sudo", "udevadm", "control", "--reload-rules"])
294+
run(["sudo", "udevadm", "trigger", "--name-match=kvm"])
295+
296+
# Free up disk space by deleting unused versions of the NDK
297+
# (https://github.com/freakboy3742/pyspamsum/pull/108).
298+
for line in ENV_SCRIPT.read_text().splitlines():
299+
if match := re.fullmatch(r"ndk_version=(.+)", line):
300+
ndk_version = match[1]
301+
break
302+
else:
303+
raise ValueError(f"Failed to find NDK version in {ENV_SCRIPT.name}")
304+
305+
for item in (android_home / "ndk").iterdir():
306+
if item.name[0].isdigit() and item.name != ndk_version:
307+
delete_glob(item)
293308

294309

295310
def setup_sdk():

Android/testbed/app/build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ android {
7979
val androidEnvFile = file("../../android-env.sh").absoluteFile
8080

8181
namespace = "org.python.testbed"
82-
compileSdk = 34
82+
compileSdk = 35
8383

8484
defaultConfig {
8585
applicationId = "org.python.testbed"
@@ -92,7 +92,7 @@ android {
9292
}
9393
throw GradleException("Failed to find API level in $androidEnvFile")
9494
}
95-
targetSdk = 34
95+
targetSdk = 35
9696

9797
versionCode = 1
9898
versionName = "1.0"

Doc/c-api/gcsupport.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,10 @@ The :c:member:`~PyTypeObject.tp_traverse` handler must have the following type:
175175
object argument. If *visit* returns a non-zero value that value should be
176176
returned immediately.
177177
178+
The traversal function must not have any side effects. Implementations
179+
may not modify the reference counts of any Python objects nor create or
180+
destroy any Python objects.
181+
178182
To simplify writing :c:member:`~PyTypeObject.tp_traverse` handlers, a :c:func:`Py_VISIT` macro is
179183
provided. In order to use this macro, the :c:member:`~PyTypeObject.tp_traverse` implementation
180184
must name its arguments exactly *visit* and *arg*:

Doc/c-api/set.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ subtypes but not for instances of :class:`frozenset` or its subtypes.
147147
148148
Return ``1`` if found and removed, ``0`` if not found (no action taken), and ``-1`` if an
149149
error is encountered. Does not raise :exc:`KeyError` for missing keys. Raise a
150-
:exc:`TypeError` if the *key* is unhashable. Unlike the Python :meth:`~frozenset.discard`
150+
:exc:`TypeError` if the *key* is unhashable. Unlike the Python :meth:`~set.discard`
151151
method, this function does not automatically convert unhashable sets into
152152
temporary frozensets. Raise :exc:`SystemError` if *set* is not an
153153
instance of :class:`set` or its subtype.

Doc/c-api/typeobj.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1483,6 +1483,11 @@ and :c:data:`PyType_Type` effectively act as defaults.)
14831483
but the instance has no strong reference to the elements inside it, as they
14841484
are allowed to be removed even if the instance is still alive).
14851485

1486+
.. warning::
1487+
The traversal function must not have any side effects. It must not
1488+
modify the reference counts of any Python objects nor create or destroy
1489+
any Python objects.
1490+
14861491
Note that :c:func:`Py_VISIT` requires the *visit* and *arg* parameters to
14871492
:c:func:`!local_traverse` to have these specific names; don't name them just
14881493
anything.

Doc/library/argparse.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1573,7 +1573,7 @@ The Namespace object
15731573
Other utilities
15741574
---------------
15751575

1576-
Sub-commands
1576+
Subcommands
15771577
^^^^^^^^^^^^
15781578

15791579
.. method:: ArgumentParser.add_subparsers(*, [title], [description], [prog], \
@@ -1602,7 +1602,7 @@ Sub-commands
16021602
* *description* - description for the sub-parser group in help output, by
16031603
default ``None``
16041604

1605-
* *prog* - usage information that will be displayed with sub-command help,
1605+
* *prog* - usage information that will be displayed with subcommand help,
16061606
by default the name of the program and any positional arguments before the
16071607
subparser argument
16081608

@@ -1612,7 +1612,7 @@ Sub-commands
16121612
* action_ - the basic type of action to be taken when this argument is
16131613
encountered at the command line
16141614

1615-
* dest_ - name of the attribute under which sub-command name will be
1615+
* dest_ - name of the attribute under which subcommand name will be
16161616
stored; by default ``None`` and no value is stored
16171617

16181618
* required_ - Whether or not a subcommand must be provided, by default

Doc/library/bdb.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ The :mod:`bdb` module also defines two classes:
213213
Normally derived classes don't override the following methods, but they may
214214
if they want to redefine the definition of stopping and breakpoints.
215215

216-
.. method:: is_skipped_line(module_name)
216+
.. method:: is_skipped_module(module_name)
217217

218218
Return ``True`` if *module_name* matches any skip pattern.
219219

Doc/library/exceptions.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -961,6 +961,12 @@ their subgroups based on the types of the contained exceptions.
961961
raises a :exc:`TypeError` if any contained exception is not an
962962
:exc:`Exception` subclass.
963963

964+
.. impl-detail::
965+
966+
The ``excs`` parameter may be any sequence, but lists and tuples are
967+
specifically processed more efficiently here. For optimal performance,
968+
pass a tuple as ``excs``.
969+
964970
.. attribute:: message
965971

966972
The ``msg`` argument to the constructor. This is a read-only attribute.

0 commit comments

Comments
 (0)