Skip to content

Commit 1f320a1

Browse files
authored
Merge branch '3.14' into backport-706fdda-3.14
2 parents 71c61fe + 8e49601 commit 1f320a1

File tree

94 files changed

+1379
-845
lines changed

Some content is hidden

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

94 files changed

+1379
-845
lines changed

.github/workflows/build.yml

Lines changed: 24 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ jobs:
238238
macOS
239239
${{ fromJSON(matrix.free-threading) && '(free-threading)' || '' }}
240240
needs: build-context
241-
if: needs.build-context.outputs.run-tests == 'true'
241+
if: needs.build-context.outputs.run-macos == 'true'
242242
strategy:
243243
fail-fast: false
244244
matrix:
@@ -264,7 +264,7 @@ jobs:
264264
${{ fromJSON(matrix.free-threading) && '(free-threading)' || '' }}
265265
${{ fromJSON(matrix.bolt) && '(bolt)' || '' }}
266266
needs: build-context
267-
if: needs.build-context.outputs.run-tests == 'true'
267+
if: needs.build-context.outputs.run-ubuntu == 'true'
268268
strategy:
269269
fail-fast: false
270270
matrix:
@@ -295,7 +295,7 @@ jobs:
295295
runs-on: ${{ matrix.os }}
296296
timeout-minutes: 60
297297
needs: build-context
298-
if: needs.build-context.outputs.run-tests == 'true'
298+
if: needs.build-context.outputs.run-ubuntu == 'true'
299299
strategy:
300300
fail-fast: false
301301
matrix:
@@ -349,7 +349,7 @@ jobs:
349349
build-android:
350350
name: Android (${{ matrix.arch }})
351351
needs: build-context
352-
if: needs.build-context.outputs.run-tests == 'true'
352+
if: needs.build-context.outputs.run-android == 'true'
353353
timeout-minutes: 60
354354
strategy:
355355
fail-fast: false
@@ -371,9 +371,9 @@ jobs:
371371
build-ios:
372372
name: iOS
373373
needs: build-context
374-
if: needs.build-context.outputs.run-tests == 'true'
374+
if: needs.build-context.outputs.run-ios == 'true'
375375
timeout-minutes: 60
376-
runs-on: macos-15
376+
runs-on: macos-14
377377
steps:
378378
- uses: actions/checkout@v4
379379
with:
@@ -386,23 +386,23 @@ jobs:
386386
# https://github.com/actions/runner-images/issues/12751.
387387
- name: Select Xcode version
388388
run: |
389-
sudo xcode-select --switch /Applications/Xcode_16.4.app
389+
sudo xcode-select --switch /Applications/Xcode_15.4.app
390390
391391
- name: Build and test
392-
run: python3 Apple ci iOS --fast-ci --simulator 'iPhone 16e,OS=18.5'
392+
run: python3 Apple ci iOS --fast-ci --simulator 'iPhone SE (3rd generation),OS=17.5'
393393

394394
build-wasi:
395395
name: 'WASI'
396396
needs: build-context
397-
if: needs.build-context.outputs.run-tests == 'true'
397+
if: needs.build-context.outputs.run-wasi == 'true'
398398
uses: ./.github/workflows/reusable-wasi.yml
399399

400400
test-hypothesis:
401401
name: "Hypothesis tests on Ubuntu"
402402
runs-on: ubuntu-24.04
403403
timeout-minutes: 60
404404
needs: build-context
405-
if: needs.build-context.outputs.run-tests == 'true'
405+
if: needs.build-context.outputs.run-ubuntu == 'true'
406406
env:
407407
OPENSSL_VER: 3.0.18
408408
PYTHONSTRICTEXTENSIONBUILD: 1
@@ -509,7 +509,7 @@ jobs:
509509
runs-on: ${{ matrix.os }}
510510
timeout-minutes: 60
511511
needs: build-context
512-
if: needs.build-context.outputs.run-tests == 'true'
512+
if: needs.build-context.outputs.run-ubuntu == 'true'
513513
strategy:
514514
fail-fast: false
515515
matrix:
@@ -562,7 +562,7 @@ jobs:
562562
# ${{ '' } is a hack to nest jobs under the same sidebar category.
563563
name: Sanitizers${{ '' }} # zizmor: ignore[obfuscation]
564564
needs: build-context
565-
if: needs.build-context.outputs.run-tests == 'true'
565+
if: needs.build-context.outputs.run-ubuntu == 'true'
566566
strategy:
567567
fail-fast: false
568568
matrix:
@@ -587,7 +587,7 @@ jobs:
587587
runs-on: ubuntu-latest
588588
timeout-minutes: 60
589589
needs: build-context
590-
if: needs.build-context.outputs.run-tests == 'true'
590+
if: needs.build-context.outputs.run-ubuntu == 'true'
591591
steps:
592592
- uses: actions/checkout@v4
593593
with:
@@ -691,43 +691,31 @@ jobs:
691691
test-hypothesis,
692692
cifuzz,
693693
allowed-skips: >-
694+
${{ !fromJSON(needs.build-context.outputs.run-docs) && 'check-docs,' || '' }}
694695
${{
695-
!fromJSON(needs.build-context.outputs.run-docs)
696+
needs.build-context.outputs.run-tests != 'true'
696697
&& '
697-
check-docs,
698+
check-autoconf-regen,
699+
check-generated-files,
698700
'
699701
|| ''
700702
}}
703+
${{ !fromJSON(needs.build-context.outputs.run-windows-tests) && 'build-windows,' || '' }}
704+
${{ !fromJSON(needs.build-context.outputs.run-ci-fuzz) && 'cifuzz,' || '' }}
705+
${{ !fromJSON(needs.build-context.outputs.run-macos) && 'build-macos,' || '' }}
701706
${{
702-
needs.build-context.outputs.run-tests != 'true'
707+
!fromJSON(needs.build-context.outputs.run-ubuntu)
703708
&& '
704-
check-autoconf-regen,
705-
check-generated-files,
706-
build-macos,
707709
build-ubuntu,
708710
build-ubuntu-ssltests,
709-
build-android,
710-
build-ios,
711-
build-wasi,
712711
test-hypothesis,
713712
build-asan,
714713
build-san,
715714
cross-build-linux,
716715
'
717716
|| ''
718717
}}
719-
${{
720-
!fromJSON(needs.build-context.outputs.run-windows-tests)
721-
&& '
722-
build-windows,
723-
'
724-
|| ''
725-
}}
726-
${{
727-
!fromJSON(needs.build-context.outputs.run-ci-fuzz)
728-
&& '
729-
cifuzz,
730-
'
731-
|| ''
732-
}}
718+
${{ !fromJSON(needs.build-context.outputs.run-android) && 'build-android,' || '' }}
719+
${{ !fromJSON(needs.build-context.outputs.run-ios) && 'build-ios,' || '' }}
720+
${{ !fromJSON(needs.build-context.outputs.run-wasi) && 'build-wasi,' || '' }}
733721
jobs: ${{ toJSON(needs) }}

.github/workflows/reusable-context.yml

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,31 +17,51 @@ 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-ios:
30+
description: Whether to run the iOS tests
31+
value: ${{ jobs.compute-changes.outputs.run-ios }} # bool
32+
run-macos:
33+
description: Whether to run the macOS tests
34+
value: ${{ jobs.compute-changes.outputs.run-macos }} # bool
2335
run-tests:
2436
description: Whether to run the regular tests
2537
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
38+
run-ubuntu:
39+
description: Whether to run the Ubuntu tests
40+
value: ${{ jobs.compute-changes.outputs.run-ubuntu }} # bool
41+
run-wasi:
42+
description: Whether to run the WASI tests
43+
value: ${{ jobs.compute-changes.outputs.run-wasi }} # bool
2944
run-windows-msi:
3045
description: Whether to run the MSI installer smoke tests
3146
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
47+
run-windows-tests:
48+
description: Whether to run the Windows tests
49+
value: ${{ jobs.compute-changes.outputs.run-windows-tests }} # bool
3550

3651
jobs:
3752
compute-changes:
3853
name: Create context from changed files
3954
runs-on: ubuntu-latest
4055
timeout-minutes: 10
4156
outputs:
57+
run-android: ${{ steps.changes.outputs.run-android }}
4258
run-ci-fuzz: ${{ steps.changes.outputs.run-ci-fuzz }}
4359
run-docs: ${{ steps.changes.outputs.run-docs }}
60+
run-ios: ${{ steps.changes.outputs.run-ios }}
61+
run-macos: ${{ steps.changes.outputs.run-macos }}
4462
run-tests: ${{ steps.changes.outputs.run-tests }}
63+
run-ubuntu: ${{ steps.changes.outputs.run-ubuntu }}
64+
run-wasi: ${{ steps.changes.outputs.run-wasi }}
4565
run-windows-msi: ${{ steps.changes.outputs.run-windows-msi }}
4666
run-windows-tests: ${{ steps.changes.outputs.run-windows-tests }}
4767
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
@@ -232,6 +232,10 @@ The :c:member:`~PyTypeObject.tp_traverse` handler must have the following type:
232232
object argument. If *visit* returns a non-zero value that value should be
233233
returned immediately.
234234
235+
The traversal function must not have any side effects. Implementations
236+
may not modify the reference counts of any Python objects nor create or
237+
destroy any Python objects.
238+
235239
To simplify writing :c:member:`~PyTypeObject.tp_traverse` handlers, a :c:func:`Py_VISIT` macro is
236240
provided. In order to use this macro, the :c:member:`~PyTypeObject.tp_traverse` implementation
237241
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
@@ -1554,6 +1554,11 @@ and :c:data:`PyType_Type` effectively act as defaults.)
15541554
but the instance has no strong reference to the elements inside it, as they
15551555
are allowed to be removed even if the instance is still alive).
15561556

1557+
.. warning::
1558+
The traversal function must not have any side effects. It must not
1559+
modify the reference counts of any Python objects nor create or destroy
1560+
any Python objects.
1561+
15571562
Note that :c:func:`Py_VISIT` requires the *visit* and *arg* parameters to
15581563
:c:func:`!local_traverse` to have these specific names; don't name them just
15591564
anything.

Doc/library/argparse.rst

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -644,6 +644,13 @@ variables and terminal capabilities. However, if ``color=False``, colored
644644
output is always disabled, even if environment variables like ``FORCE_COLOR``
645645
are set.
646646

647+
.. note::
648+
649+
Error messages will include color codes when redirecting stderr to a
650+
file. To avoid this, set the |NO_COLOR|_ or :envvar:`PYTHON_COLORS`
651+
environment variable (for example,
652+
``NO_COLOR=1 python script.py 2> errors.txt``).
653+
647654
.. versionadded:: 3.14
648655

649656

@@ -1662,7 +1669,7 @@ The Namespace object
16621669
Other utilities
16631670
---------------
16641671

1665-
Sub-commands
1672+
Subcommands
16661673
^^^^^^^^^^^^
16671674

16681675
.. method:: ArgumentParser.add_subparsers(*, [title], [description], [prog], \
@@ -1691,7 +1698,7 @@ Sub-commands
16911698
* *description* - description for the sub-parser group in help output, by
16921699
default ``None``
16931700

1694-
* *prog* - usage information that will be displayed with sub-command help,
1701+
* *prog* - usage information that will be displayed with subcommand help,
16951702
by default the name of the program and any positional arguments before the
16961703
subparser argument
16971704

@@ -1701,7 +1708,7 @@ Sub-commands
17011708
* action_ - the basic type of action to be taken when this argument is
17021709
encountered at the command line
17031710

1704-
* dest_ - name of the attribute under which sub-command name will be
1711+
* dest_ - name of the attribute under which subcommand name will be
17051712
stored; by default ``None`` and no value is stored
17061713

17071714
* 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
@@ -240,7 +240,7 @@ The :mod:`bdb` module also defines two classes:
240240
Normally derived classes don't override the following methods, but they may
241241
if they want to redefine the definition of stopping and breakpoints.
242242

243-
.. method:: is_skipped_line(module_name)
243+
.. method:: is_skipped_module(module_name)
244244

245245
Return ``True`` if *module_name* matches any skip pattern.
246246

0 commit comments

Comments
 (0)