Skip to content

Commit 241d6e0

Browse files
authored
Merge branch 'main' into remove-__cached__
2 parents ddb36a1 + dac4589 commit 241d6e0

File tree

374 files changed

+38409
-8925
lines changed

Some content is hidden

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

374 files changed

+38409
-8925
lines changed

.github/CODEOWNERS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,9 @@ Doc/howto/clinic.rst @erlend-aasland @AA-Turner
126126
# C Analyser
127127
Tools/c-analyzer/ @ericsnowcurrently
128128

129+
# C API Documentation Checks
130+
Tools/check-c-api-docs/ @ZeroIntensity
131+
129132
# Fuzzing
130133
Modules/_xxtestfuzz/ @ammaraskar
131134

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,6 @@ contact_links:
55
- name: "Proposing new features"
66
about: "Submit major feature proposal (e.g. syntax changes) to an ideas forum first."
77
url: "https://discuss.python.org/c/ideas/6"
8+
- name: "Python Install Manager issues"
9+
about: "Report issues with the Python Install Manager (for Windows)"
10+
url: "https://github.com/python/pymanager/issues"

.github/workflows/build.yml

Lines changed: 29 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,9 @@ jobs:
142142
- name: Check for unsupported C global variables
143143
if: github.event_name == 'pull_request' # $GITHUB_EVENT_NAME
144144
run: make check-c-globals
145+
- name: Check for undocumented C APIs
146+
run: make check-c-api-docs
147+
145148

146149
build-windows:
147150
name: >-
@@ -188,7 +191,7 @@ jobs:
188191
macOS
189192
${{ fromJSON(matrix.free-threading) && '(free-threading)' || '' }}
190193
needs: build-context
191-
if: needs.build-context.outputs.run-tests == 'true'
194+
if: needs.build-context.outputs.run-macos == 'true'
192195
strategy:
193196
fail-fast: false
194197
matrix:
@@ -214,7 +217,7 @@ jobs:
214217
${{ fromJSON(matrix.free-threading) && '(free-threading)' || '' }}
215218
${{ fromJSON(matrix.bolt) && '(bolt)' || '' }}
216219
needs: build-context
217-
if: needs.build-context.outputs.run-tests == 'true'
220+
if: needs.build-context.outputs.run-ubuntu == 'true'
218221
strategy:
219222
fail-fast: false
220223
matrix:
@@ -245,7 +248,7 @@ jobs:
245248
runs-on: ${{ matrix.os }}
246249
timeout-minutes: 60
247250
needs: build-context
248-
if: needs.build-context.outputs.run-tests == 'true'
251+
if: needs.build-context.outputs.run-ubuntu == 'true'
249252
strategy:
250253
fail-fast: false
251254
matrix:
@@ -301,7 +304,7 @@ jobs:
301304
runs-on: ${{ matrix.os }}
302305
timeout-minutes: 60
303306
needs: build-context
304-
if: needs.build-context.outputs.run-tests == 'true'
307+
if: needs.build-context.outputs.run-ubuntu == 'true'
305308
strategy:
306309
fail-fast: false
307310
matrix:
@@ -365,7 +368,7 @@ jobs:
365368
build-android:
366369
name: Android (${{ matrix.arch }})
367370
needs: build-context
368-
if: needs.build-context.outputs.run-tests == 'true'
371+
if: needs.build-context.outputs.run-android == 'true'
369372
timeout-minutes: 60
370373
strategy:
371374
fail-fast: false
@@ -387,9 +390,9 @@ jobs:
387390
build-ios:
388391
name: iOS
389392
needs: build-context
390-
if: needs.build-context.outputs.run-tests == 'true'
393+
if: needs.build-context.outputs.run-ios == 'true'
391394
timeout-minutes: 60
392-
runs-on: macos-15
395+
runs-on: macos-14
393396
steps:
394397
- uses: actions/checkout@v4
395398
with:
@@ -402,23 +405,23 @@ jobs:
402405
# https://github.com/actions/runner-images/issues/12751.
403406
- name: Select Xcode version
404407
run: |
405-
sudo xcode-select --switch /Applications/Xcode_16.4.app
408+
sudo xcode-select --switch /Applications/Xcode_15.4.app
406409
407410
- name: Build and test
408-
run: python3 Apple ci iOS --fast-ci --simulator 'iPhone 16e,OS=18.5'
411+
run: python3 Apple ci iOS --fast-ci --simulator 'iPhone SE (3rd generation),OS=17.5'
409412

410413
build-wasi:
411414
name: 'WASI'
412415
needs: build-context
413-
if: needs.build-context.outputs.run-tests == 'true'
416+
if: needs.build-context.outputs.run-wasi == 'true'
414417
uses: ./.github/workflows/reusable-wasi.yml
415418

416419
test-hypothesis:
417420
name: "Hypothesis tests on Ubuntu"
418421
runs-on: ubuntu-24.04
419422
timeout-minutes: 60
420423
needs: build-context
421-
if: needs.build-context.outputs.run-tests == 'true'
424+
if: needs.build-context.outputs.run-ubuntu == 'true'
422425
env:
423426
OPENSSL_VER: 3.0.18
424427
PYTHONSTRICTEXTENSIONBUILD: 1
@@ -525,7 +528,7 @@ jobs:
525528
runs-on: ${{ matrix.os }}
526529
timeout-minutes: 60
527530
needs: build-context
528-
if: needs.build-context.outputs.run-tests == 'true'
531+
if: needs.build-context.outputs.run-ubuntu == 'true'
529532
strategy:
530533
fail-fast: false
531534
matrix:
@@ -578,7 +581,7 @@ jobs:
578581
# ${{ '' } is a hack to nest jobs under the same sidebar category.
579582
name: Sanitizers${{ '' }} # zizmor: ignore[obfuscation]
580583
needs: build-context
581-
if: needs.build-context.outputs.run-tests == 'true'
584+
if: needs.build-context.outputs.run-ubuntu == 'true'
582585
strategy:
583586
fail-fast: false
584587
matrix:
@@ -603,7 +606,7 @@ jobs:
603606
runs-on: ubuntu-latest
604607
timeout-minutes: 60
605608
needs: build-context
606-
if: needs.build-context.outputs.run-tests == 'true'
609+
if: needs.build-context.outputs.run-ubuntu == 'true'
607610
steps:
608611
- uses: actions/checkout@v4
609612
with:
@@ -703,50 +706,39 @@ jobs:
703706
uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe
704707
with:
705708
allowed-failures: >-
709+
build-ios,
706710
build-windows-msi,
707711
build-ubuntu-ssltests-awslc,
708712
build-ubuntu-ssltests-openssl,
709713
test-hypothesis,
710714
cifuzz,
711715
allowed-skips: >-
716+
${{ !fromJSON(needs.build-context.outputs.run-docs) && 'check-docs,' || '' }}
712717
${{
713-
!fromJSON(needs.build-context.outputs.run-docs)
718+
needs.build-context.outputs.run-tests != 'true'
714719
&& '
715-
check-docs,
720+
check-autoconf-regen,
721+
check-generated-files,
716722
'
717723
|| ''
718724
}}
725+
${{ !fromJSON(needs.build-context.outputs.run-windows-tests) && 'build-windows,' || '' }}
726+
${{ !fromJSON(needs.build-context.outputs.run-ci-fuzz) && 'cifuzz,' || '' }}
727+
${{ !fromJSON(needs.build-context.outputs.run-macos) && 'build-macos,' || '' }}
719728
${{
720-
needs.build-context.outputs.run-tests != 'true'
729+
!fromJSON(needs.build-context.outputs.run-ubuntu)
721730
&& '
722-
check-autoconf-regen,
723-
check-generated-files,
724-
build-macos,
725731
build-ubuntu,
726732
build-ubuntu-ssltests-awslc,
727733
build-ubuntu-ssltests-openssl,
728-
build-android,
729-
build-ios,
730-
build-wasi,
731734
test-hypothesis,
732735
build-asan,
733736
build-san,
734737
cross-build-linux,
735738
'
736739
|| ''
737740
}}
738-
${{
739-
!fromJSON(needs.build-context.outputs.run-windows-tests)
740-
&& '
741-
build-windows,
742-
'
743-
|| ''
744-
}}
745-
${{
746-
!fromJSON(needs.build-context.outputs.run-ci-fuzz)
747-
&& '
748-
cifuzz,
749-
'
750-
|| ''
751-
}}
741+
${{ !fromJSON(needs.build-context.outputs.run-android) && 'build-android,' || '' }}
742+
${{ !fromJSON(needs.build-context.outputs.run-ios) && 'build-ios,' || '' }}
743+
${{ !fromJSON(needs.build-context.outputs.run-wasi) && 'build-wasi,' || '' }}
752744
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
@@ -1569,6 +1569,11 @@ and :c:data:`PyType_Type` effectively act as defaults.)
15691569
but the instance has no strong reference to the elements inside it, as they
15701570
are allowed to be removed even if the instance is still alive).
15711571

1572+
.. warning::
1573+
The traversal function must not have any side effects. It must not
1574+
modify the reference counts of any Python objects nor create or destroy
1575+
any Python objects.
1576+
15721577
Note that :c:func:`Py_VISIT` requires the *visit* and *arg* parameters to
15731578
:c:func:`!local_traverse` to have these specific names; don't name them just
15741579
anything.

0 commit comments

Comments
 (0)