Skip to content

Commit 4809d9e

Browse files
authored
Merge branch 'main' into gh-115627
2 parents 3e30ddf + 3be9b9d commit 4809d9e

File tree

1,136 files changed

+60199
-27673
lines changed

Some content is hidden

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

1,136 files changed

+60199
-27673
lines changed

.devcontainer/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ FROM docker.io/library/fedora:37
22

33
ENV CC=clang
44

5-
ENV WASI_SDK_VERSION=20
5+
ENV WASI_SDK_VERSION=21
66
ENV WASI_SDK_PATH=/opt/wasi-sdk
77

88
ENV WASMTIME_HOME=/opt/wasmtime
9-
ENV WASMTIME_VERSION=14.0.4
9+
ENV WASMTIME_VERSION=18.0.3
1010
ENV WASMTIME_CPU_ARCH=x86_64
1111

1212
RUN dnf -y --nodocs --setopt=install_weak_deps=False install /usr/bin/{blurb,clang,curl,git,ln,tar,xz} 'dnf-command(builddep)' && \

.editorconfig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
root = true
22

3-
[*.{py,c,cpp,h,rst,md,yml}]
3+
[*.{py,c,cpp,h,js,rst,md,yml}]
44
trim_trailing_whitespace = true
55
insert_final_newline = true
66
indent_style = space
@@ -11,5 +11,5 @@ indent_size = 4
1111
[*.rst]
1212
indent_size = 3
1313

14-
[*.yml]
14+
[*.{js,yml}]
1515
indent_size = 2

.gitattributes

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,14 @@ Include/internal/pycore_opcode.h generated
7777
Include/internal/pycore_opcode_metadata.h generated
7878
Include/internal/pycore_*_generated.h generated
7979
Include/internal/pycore_uop_ids.h generated
80+
Include/internal/pycore_uop_metadata.h generated
8081
Include/opcode.h generated
8182
Include/opcode_ids.h generated
8283
Include/token.h generated
8384
Lib/_opcode_metadata.py generated
8485
Lib/keyword.py generated
86+
Lib/test/certdata/*.pem generated
87+
Lib/test/certdata/*.0 generated
8588
Lib/test/levenshtein_examples.json generated
8689
Lib/test/test_stable_abi_ctypes.py generated
8790
Lib/token.py generated
@@ -94,6 +97,7 @@ Programs/test_frozenmain.h generated
9497
Python/Python-ast.c generated
9598
Python/executor_cases.c.h generated
9699
Python/generated_cases.c.h generated
100+
Python/optimizer_cases.c.h generated
97101
Python/opcode_targets.h generated
98102
Python/stdlib_module_names.h generated
99103
Tools/peg_generator/pegen/grammar_parser.py generated

.github/CODEOWNERS

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ Python/flowgraph.c @markshannon @iritkatriel
3737
Python/ast_opt.c @isidentical
3838
Python/bytecodes.c @markshannon @gvanrossum
3939
Python/optimizer*.c @markshannon @gvanrossum
40+
Python/optimizer_analysis.c @Fidget-Spinner
41+
Python/optimizer_bytecodes.c @Fidget-Spinner
4042
Lib/test/test_patma.py @brandtbucher
4143
Lib/test/test_type_*.py @JelleZijlstra
4244
Lib/test/test_capi/test_misc.py @markshannon @gvanrossum
@@ -117,7 +119,7 @@ Python/dynload_*.c @ericsnowcurrently
117119
Lib/test/test_module/ @ericsnowcurrently
118120
Doc/c-api/module.rst @ericsnowcurrently
119121
**/*importlib/resources/* @jaraco @warsaw @FFY00
120-
**/importlib/metadata/* @jaraco @warsaw
122+
**/*importlib/metadata/* @jaraco @warsaw
121123

122124
# Dates and times
123125
**/*datetime* @pganssle @abalkin
@@ -245,5 +247,10 @@ Lib/test/test_interpreters/ @ericsnowcurrently
245247
/Tools/wasm/ @brettcannon
246248

247249
# SBOM
250+
/Misc/externals.spdx.json @sethmlarson
248251
/Misc/sbom.spdx.json @sethmlarson
249252
/Tools/build/generate_sbom.py @sethmlarson
253+
254+
# Config Parser
255+
Lib/configparser.py @jaraco
256+
Lib/test/test_configparser.py @jaraco

.github/workflows/build.yml

Lines changed: 52 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ jobs:
9797
- name: Get a list of the changed documentation-related files
9898
if: github.event_name == 'pull_request'
9999
id: changed-docs-files
100-
uses: Ana06/get-changed-files@v2.2.0
100+
uses: Ana06/get-changed-files@v2.3.0
101101
with:
102102
filter: |
103103
Doc/**
@@ -131,11 +131,13 @@ jobs:
131131
- uses: actions/setup-python@v5
132132
with:
133133
python-version: '3.x'
134+
- name: Runner image version
135+
run: echo "IMAGE_VERSION=${ImageVersion}" >> $GITHUB_ENV
134136
- name: Restore config.cache
135137
uses: actions/cache@v4
136138
with:
137139
path: config.cache
138-
key: ${{ github.job }}-${{ runner.os }}-${{ needs.check_source.outputs.config_hash }}-${{ env.pythonLocation }}
140+
key: ${{ github.job }}-${{ runner.os }}-${{ env.IMAGE_VERSION }}-${{ needs.check_source.outputs.config_hash }}-${{ env.pythonLocation }}
139141
- name: Install Dependencies
140142
run: sudo ./.github/workflows/posix-deps-apt.sh
141143
- name: Add ccache to PATH
@@ -160,7 +162,7 @@ jobs:
160162
- name: Build CPython
161163
run: |
162164
make -j4 regen-all
163-
make regen-stdlib-module-names
165+
make regen-stdlib-module-names regen-sbom
164166
- name: Check for changes
165167
run: |
166168
git add -u
@@ -204,6 +206,8 @@ jobs:
204206
uses: ./.github/workflows/reusable-macos.yml
205207
with:
206208
config_hash: ${{ needs.check_source.outputs.config_hash }}
209+
# macos-14 is M1, macos-13 is Intel
210+
os-matrix: '["macos-14", "macos-13"]'
207211

208212
build_macos_free_threading:
209213
name: 'macOS (free-threading)'
@@ -213,6 +217,8 @@ jobs:
213217
with:
214218
config_hash: ${{ needs.check_source.outputs.config_hash }}
215219
free-threading: true
220+
# macos-14 is M1
221+
os-matrix: '["macos-14"]'
216222

217223
build_ubuntu:
218224
name: 'Ubuntu'
@@ -258,11 +264,13 @@ jobs:
258264
LD_LIBRARY_PATH: ${{ github.workspace }}/multissl/openssl/${{ matrix.openssl_ver }}/lib
259265
steps:
260266
- uses: actions/checkout@v4
267+
- name: Runner image version
268+
run: echo "IMAGE_VERSION=${ImageVersion}" >> $GITHUB_ENV
261269
- name: Restore config.cache
262270
uses: actions/cache@v4
263271
with:
264272
path: config.cache
265-
key: ${{ github.job }}-${{ runner.os }}-${{ needs.check_source.outputs.config_hash }}
273+
key: ${{ github.job }}-${{ runner.os }}-${{ env.IMAGE_VERSION }}-${{ needs.check_source.outputs.config_hash }}
266274
- name: Register gcc problem matcher
267275
run: echo "::add-matcher::.github/problem-matchers/gcc.json"
268276
- name: Install Dependencies
@@ -297,6 +305,14 @@ jobs:
297305
- name: SSL tests
298306
run: ./python Lib/test/ssltests.py
299307

308+
build_wasi:
309+
name: 'WASI'
310+
needs: check_source
311+
if: needs.check_source.outputs.run_tests == 'true'
312+
uses: ./.github/workflows/reusable-wasi.yml
313+
with:
314+
config_hash: ${{ needs.check_source.outputs.config_hash }}
315+
300316
test_hypothesis:
301317
name: "Hypothesis tests on Ubuntu"
302318
runs-on: ubuntu-20.04
@@ -341,11 +357,13 @@ jobs:
341357
run: mkdir -p $CPYTHON_RO_SRCDIR $CPYTHON_BUILDDIR
342358
- name: Bind mount sources read-only
343359
run: sudo mount --bind -o ro $GITHUB_WORKSPACE $CPYTHON_RO_SRCDIR
360+
- name: Runner image version
361+
run: echo "IMAGE_VERSION=${ImageVersion}" >> $GITHUB_ENV
344362
- name: Restore config.cache
345363
uses: actions/cache@v4
346364
with:
347365
path: ${{ env.CPYTHON_BUILDDIR }}/config.cache
348-
key: ${{ github.job }}-${{ runner.os }}-${{ needs.check_source.outputs.config_hash }}
366+
key: ${{ github.job }}-${{ runner.os }}-${{ env.IMAGE_VERSION }}-${{ needs.check_source.outputs.config_hash }}
349367
- name: Configure CPython out-of-tree
350368
working-directory: ${{ env.CPYTHON_BUILDDIR }}
351369
run: |
@@ -420,11 +438,13 @@ jobs:
420438
ASAN_OPTIONS: detect_leaks=0:allocator_may_return_null=1:handle_segv=0
421439
steps:
422440
- uses: actions/checkout@v4
441+
- name: Runner image version
442+
run: echo "IMAGE_VERSION=${ImageVersion}" >> $GITHUB_ENV
423443
- name: Restore config.cache
424444
uses: actions/cache@v4
425445
with:
426446
path: config.cache
427-
key: ${{ github.job }}-${{ runner.os }}-${{ needs.check_source.outputs.config_hash }}
447+
key: ${{ github.job }}-${{ runner.os }}-${{ env.IMAGE_VERSION }}-${{ needs.check_source.outputs.config_hash }}
428448
- name: Register gcc problem matcher
429449
run: echo "::add-matcher::.github/problem-matchers/gcc.json"
430450
- name: Install Dependencies
@@ -464,6 +484,24 @@ jobs:
464484
- name: Tests
465485
run: xvfb-run make test
466486

487+
build_tsan:
488+
name: 'Thread sanitizer'
489+
needs: check_source
490+
if: needs.check_source.outputs.run_tests == 'true'
491+
uses: ./.github/workflows/reusable-tsan.yml
492+
with:
493+
config_hash: ${{ needs.check_source.outputs.config_hash }}
494+
options: ./configure --config-cache --with-thread-sanitizer --with-pydebug
495+
496+
build_tsan_free_threading:
497+
name: 'Thread sanitizer (free-threading)'
498+
needs: check_source
499+
if: needs.check_source.outputs.run_tests == 'true'
500+
uses: ./.github/workflows/reusable-tsan.yml
501+
with:
502+
config_hash: ${{ needs.check_source.outputs.config_hash }}
503+
options: ./configure --config-cache --disable-gil --with-thread-sanitizer --with-pydebug
504+
467505
# CIFuzz job based on https://google.github.io/oss-fuzz/getting-started/continuous-integration/
468506
cifuzz:
469507
name: CIFuzz
@@ -476,7 +514,8 @@ jobs:
476514
strategy:
477515
fail-fast: false
478516
matrix:
479-
sanitizer: [address, undefined, memory]
517+
# sanitizer: [address, undefined, memory] -- memory skipped temporarily until GH-116886 is solved.
518+
sanitizer: [address, undefined]
480519
steps:
481520
- name: Build fuzzers (${{ matrix.sanitizer }})
482521
id: build
@@ -517,10 +556,13 @@ jobs:
517556
- build_ubuntu
518557
- build_ubuntu_free_threading
519558
- build_ubuntu_ssltests
559+
- build_wasi
520560
- build_windows
521561
- build_windows_free_threading
522562
- test_hypothesis
523563
- build_asan
564+
- build_tsan
565+
- build_tsan_free_threading
524566
- cifuzz
525567

526568
runs-on: ubuntu-latest
@@ -550,9 +592,12 @@ jobs:
550592
build_ubuntu,
551593
build_ubuntu_free_threading,
552594
build_ubuntu_ssltests,
595+
build_wasi,
553596
build_windows,
554597
build_windows_free_threading,
555598
build_asan,
599+
build_tsan,
600+
build_tsan_free_threading,
556601
'
557602
|| ''
558603
}}

.github/workflows/jit.yml

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,14 @@ on:
44
paths:
55
- '**jit**'
66
- 'Python/bytecodes.c'
7+
- 'Python/optimizer*.c'
8+
- 'Python/optimizer_bytecodes.c'
79
push:
810
paths:
911
- '**jit**'
1012
- 'Python/bytecodes.c'
13+
- 'Python/optimizer*.c'
14+
- 'Python/optimizer_bytecodes.c'
1115
workflow_dispatch:
1216

1317
concurrency:
@@ -25,6 +29,7 @@ jobs:
2529
target:
2630
- i686-pc-windows-msvc/msvc
2731
- x86_64-pc-windows-msvc/msvc
32+
- aarch64-pc-windows-msvc/msvc
2833
- x86_64-apple-darwin/clang
2934
- aarch64-apple-darwin/clang
3035
- x86_64-unknown-linux-gnu/gcc
@@ -45,6 +50,10 @@ jobs:
4550
architecture: x64
4651
runner: windows-latest
4752
compiler: msvc
53+
- target: aarch64-pc-windows-msvc/msvc
54+
architecture: ARM64
55+
runner: windows-latest
56+
compiler: msvc
4857
- target: x86_64-apple-darwin/clang
4958
architecture: x86_64
5059
runner: macos-13
@@ -66,13 +75,13 @@ jobs:
6675
runner: ubuntu-latest
6776
compiler: gcc
6877
# These fail because of emulation, not because of the JIT:
69-
exclude: test_unix_events test_init test_process_pool test_shutdown test_multiprocessing_fork test_cmd_line test_faulthandler test_os test_perf_profiler test_posix test_signal test_socket test_subprocess test_threading test_venv
78+
exclude: test_unix_events test_init test_process_pool test_shutdown test_multiprocessing_fork test_cmd_line test_faulthandler test_os test_perf_profiler test_posix test_signal test_socket test_subprocess test_threading test_venv test_external_inspection
7079
- target: aarch64-unknown-linux-gnu/clang
7180
architecture: aarch64
7281
runner: ubuntu-latest
7382
compiler: clang
7483
# These fail because of emulation, not because of the JIT:
75-
exclude: test_unix_events test_init test_process_pool test_shutdown test_multiprocessing_fork test_cmd_line test_faulthandler test_os test_perf_profiler test_posix test_signal test_socket test_subprocess test_threading test_venv
84+
exclude: test_unix_events test_init test_process_pool test_shutdown test_multiprocessing_fork test_cmd_line test_faulthandler test_os test_perf_profiler test_posix test_signal test_socket test_subprocess test_threading test_venv test_external_inspection
7685
env:
7786
CC: ${{ matrix.compiler }}
7887
steps:
@@ -81,19 +90,26 @@ jobs:
8190
with:
8291
python-version: '3.11'
8392

84-
- name: Windows
85-
if: runner.os == 'Windows'
93+
- name: Native Windows
94+
if: runner.os == 'Windows' && matrix.architecture != 'ARM64'
8695
run: |
8796
choco install llvm --allow-downgrade --no-progress --version ${{ matrix.llvm }}
8897
./PCbuild/build.bat --experimental-jit ${{ matrix.debug && '-d' || '--pgo' }} -p ${{ matrix.architecture }}
8998
./PCbuild/rt.bat ${{ matrix.debug && '-d' }} -p ${{ matrix.architecture }} -q --exclude ${{ matrix.exclude }} --multiprocess 0 --timeout 3600 --verbose2 --verbose3
9099
91-
- name: macOS
100+
# No PGO or tests (yet):
101+
- name: Emulated Windows
102+
if: runner.os == 'Windows' && matrix.architecture == 'ARM64'
103+
run: |
104+
choco install llvm --allow-downgrade --no-progress --version ${{ matrix.llvm }}
105+
./PCbuild/build.bat --experimental-jit ${{ matrix.debug && '-d' || '' }} -p ${{ matrix.architecture }}
106+
107+
- name: Native macOS
92108
if: runner.os == 'macOS'
93109
run: |
94110
brew install llvm@${{ matrix.llvm }}
95-
export SDKROOT="$(xcrun --show-sdk-path)"
96-
./configure --enable-experimental-jit ${{ matrix.debug && '--with-pydebug' || '--enable-optimizations --with-lto' }}
111+
SDKROOT="$(xcrun --show-sdk-path)" \
112+
./configure --enable-experimental-jit ${{ matrix.debug && '--with-pydebug' || '--enable-optimizations --with-lto' }}
97113
make all --jobs 4
98114
./python.exe -m test --exclude ${{ matrix.exclude }} --multiprocess 0 --timeout 3600 --verbose2 --verbose3
99115
@@ -118,10 +134,10 @@ jobs:
118134
sudo apt install --yes "gcc-$HOST" qemu-user
119135
${{ !matrix.debug && matrix.compiler == 'clang' && './configure --enable-optimizations' || '' }}
120136
${{ !matrix.debug && matrix.compiler == 'clang' && 'make profile-run-stamp --jobs 4' || '' }}
121-
export CC="${{ matrix.compiler == 'clang' && 'clang --target=$HOST' || '$HOST-gcc' }}"
122-
export CPP="$CC --preprocess"
123-
export HOSTRUNNER=qemu-${{ matrix.architecture }}
124137
export QEMU_LD_PREFIX="/usr/$HOST"
125-
./configure --enable-experimental-jit ${{ matrix.debug && '--with-pydebug' || '--enable-optimizations --with-lto' }} --build=x86_64-linux-gnu --host="$HOST" --with-build-python=../build/bin/python3 --with-pkg-config=no ac_cv_buggy_getaddrinfo=no ac_cv_file__dev_ptc=no ac_cv_file__dev_ptmx=yes
138+
CC="${{ matrix.compiler == 'clang' && 'clang --target=$HOST' || '$HOST-gcc' }}" \
139+
CPP="$CC --preprocess" \
140+
HOSTRUNNER=qemu-${{ matrix.architecture }} \
141+
./configure --enable-experimental-jit ${{ matrix.debug && '--with-pydebug' || '--enable-optimizations --with-lto' }} --build=x86_64-linux-gnu --host="$HOST" --with-build-python=../build/bin/python3 --with-pkg-config=no ac_cv_buggy_getaddrinfo=no ac_cv_file__dev_ptc=no ac_cv_file__dev_ptmx=yes
126142
make all --jobs 4
127143
./python -m test --exclude ${{ matrix.exclude }} --multiprocess 0 --timeout 3600 --verbose2 --verbose3

.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ jobs:
2323
- uses: actions/setup-python@v5
2424
with:
2525
python-version: "3.x"
26-
- uses: pre-commit/[email protected].0
26+
- uses: pre-commit/[email protected].1

.github/workflows/project-updater.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
- { project: 32, label: sprint }
2424

2525
steps:
26-
- uses: actions/add-to-project@v0.1.0
26+
- uses: actions/add-to-project@v0.6.0
2727
with:
2828
project-url: https://github.com/orgs/python/projects/${{ matrix.project }}
2929
github-token: ${{ secrets.ADD_TO_PROJECT_PAT }}

0 commit comments

Comments
 (0)