Skip to content

Commit ae34ddb

Browse files
committed
Merge remote-tracking branch 'upstream/main' into multiprocessing-queue-shutdown
2 parents f5fcdd6 + 8383915 commit ae34ddb

File tree

877 files changed

+44261
-20253
lines changed

Some content is hidden

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

877 files changed

+44261
-20253
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)' && \

.gitattributes

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ Include/opcode_ids.h generated
8383
Include/token.h generated
8484
Lib/_opcode_metadata.py generated
8585
Lib/keyword.py generated
86+
Lib/test/certdata/*.pem generated
87+
Lib/test/certdata/*.0 generated
8688
Lib/test/levenshtein_examples.json generated
8789
Lib/test/test_stable_abi_ctypes.py generated
8890
Lib/token.py generated
@@ -95,7 +97,7 @@ Programs/test_frozenmain.h generated
9597
Python/Python-ast.c generated
9698
Python/executor_cases.c.h generated
9799
Python/generated_cases.c.h generated
98-
Python/tier2_redundancy_eliminator_cases.c.h generated
100+
Python/optimizer_cases.c.h generated
99101
Python/opcode_targets.h generated
100102
Python/stdlib_module_names.h generated
101103
Tools/peg_generator/pegen/grammar_parser.py generated

.github/CODEOWNERS

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Python/ast_opt.c @isidentical
3838
Python/bytecodes.c @markshannon @gvanrossum
3939
Python/optimizer*.c @markshannon @gvanrossum
4040
Python/optimizer_analysis.c @Fidget-Spinner
41-
Python/tier2_redundancy_eliminator_bytecodes.c @Fidget-Spinner
41+
Python/optimizer_bytecodes.c @Fidget-Spinner
4242
Lib/test/test_patma.py @brandtbucher
4343
Lib/test/test_type_*.py @JelleZijlstra
4444
Lib/test/test_capi/test_misc.py @markshannon @gvanrossum
@@ -119,7 +119,7 @@ Python/dynload_*.c @ericsnowcurrently
119119
Lib/test/test_module/ @ericsnowcurrently
120120
Doc/c-api/module.rst @ericsnowcurrently
121121
**/*importlib/resources/* @jaraco @warsaw @FFY00
122-
**/importlib/metadata/* @jaraco @warsaw
122+
**/*importlib/metadata/* @jaraco @warsaw
123123

124124
# Dates and times
125125
**/*datetime* @pganssle @abalkin
@@ -247,5 +247,10 @@ Lib/test/test_interpreters/ @ericsnowcurrently
247247
/Tools/wasm/ @brettcannon
248248

249249
# SBOM
250+
/Misc/externals.spdx.json @sethmlarson
250251
/Misc/sbom.spdx.json @sethmlarson
251252
/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: 40 additions & 3 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/**
@@ -162,7 +162,7 @@ jobs:
162162
- name: Build CPython
163163
run: |
164164
make -j4 regen-all
165-
make regen-stdlib-module-names
165+
make regen-stdlib-module-names regen-sbom
166166
- name: Check for changes
167167
run: |
168168
git add -u
@@ -206,6 +206,8 @@ jobs:
206206
uses: ./.github/workflows/reusable-macos.yml
207207
with:
208208
config_hash: ${{ needs.check_source.outputs.config_hash }}
209+
# macos-14 is M1, macos-13 is Intel
210+
os-matrix: '["macos-14", "macos-13"]'
209211

210212
build_macos_free_threading:
211213
name: 'macOS (free-threading)'
@@ -215,6 +217,8 @@ jobs:
215217
with:
216218
config_hash: ${{ needs.check_source.outputs.config_hash }}
217219
free-threading: true
220+
# macos-14 is M1
221+
os-matrix: '["macos-14"]'
218222

219223
build_ubuntu:
220224
name: 'Ubuntu'
@@ -301,6 +305,14 @@ jobs:
301305
- name: SSL tests
302306
run: ./python Lib/test/ssltests.py
303307

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+
304316
test_hypothesis:
305317
name: "Hypothesis tests on Ubuntu"
306318
runs-on: ubuntu-20.04
@@ -472,6 +484,24 @@ jobs:
472484
- name: Tests
473485
run: xvfb-run make test
474486

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+
475505
# CIFuzz job based on https://google.github.io/oss-fuzz/getting-started/continuous-integration/
476506
cifuzz:
477507
name: CIFuzz
@@ -484,7 +514,8 @@ jobs:
484514
strategy:
485515
fail-fast: false
486516
matrix:
487-
sanitizer: [address, undefined, memory]
517+
# sanitizer: [address, undefined, memory] -- memory skipped temporarily until GH-116886 is solved.
518+
sanitizer: [address, undefined]
488519
steps:
489520
- name: Build fuzzers (${{ matrix.sanitizer }})
490521
id: build
@@ -525,10 +556,13 @@ jobs:
525556
- build_ubuntu
526557
- build_ubuntu_free_threading
527558
- build_ubuntu_ssltests
559+
- build_wasi
528560
- build_windows
529561
- build_windows_free_threading
530562
- test_hypothesis
531563
- build_asan
564+
- build_tsan
565+
- build_tsan_free_threading
532566
- cifuzz
533567

534568
runs-on: ubuntu-latest
@@ -558,9 +592,12 @@ jobs:
558592
build_ubuntu,
559593
build_ubuntu_free_threading,
560594
build_ubuntu_ssltests,
595+
build_wasi,
561596
build_windows,
562597
build_windows_free_threading,
563598
build_asan,
599+
build_tsan,
600+
build_tsan_free_threading,
564601
'
565602
|| ''
566603
}}

.github/workflows/jit.yml

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ on:
55
- '**jit**'
66
- 'Python/bytecodes.c'
77
- 'Python/optimizer*.c'
8-
- 'Python/tier2_redundancy_eliminator_bytecodes.c'
8+
- 'Python/optimizer_bytecodes.c'
99
push:
1010
paths:
1111
- '**jit**'
1212
- 'Python/bytecodes.c'
1313
- 'Python/optimizer*.c'
14-
- 'Python/tier2_redundancy_eliminator_bytecodes.c'
14+
- 'Python/optimizer_bytecodes.c'
1515
workflow_dispatch:
1616

1717
concurrency:
@@ -29,6 +29,7 @@ jobs:
2929
target:
3030
- i686-pc-windows-msvc/msvc
3131
- x86_64-pc-windows-msvc/msvc
32+
- aarch64-pc-windows-msvc/msvc
3233
- x86_64-apple-darwin/clang
3334
- aarch64-apple-darwin/clang
3435
- x86_64-unknown-linux-gnu/gcc
@@ -49,6 +50,10 @@ jobs:
4950
architecture: x64
5051
runner: windows-latest
5152
compiler: msvc
53+
- target: aarch64-pc-windows-msvc/msvc
54+
architecture: ARM64
55+
runner: windows-latest
56+
compiler: msvc
5257
- target: x86_64-apple-darwin/clang
5358
architecture: x86_64
5459
runner: macos-13
@@ -70,13 +75,13 @@ jobs:
7075
runner: ubuntu-latest
7176
compiler: gcc
7277
# These fail because of emulation, not because of the JIT:
73-
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
7479
- target: aarch64-unknown-linux-gnu/clang
7580
architecture: aarch64
7681
runner: ubuntu-latest
7782
compiler: clang
7883
# These fail because of emulation, not because of the JIT:
79-
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
8085
env:
8186
CC: ${{ matrix.compiler }}
8287
steps:
@@ -85,19 +90,26 @@ jobs:
8590
with:
8691
python-version: '3.11'
8792

88-
- name: Windows
89-
if: runner.os == 'Windows'
93+
- name: Native Windows
94+
if: runner.os == 'Windows' && matrix.architecture != 'ARM64'
9095
run: |
9196
choco install llvm --allow-downgrade --no-progress --version ${{ matrix.llvm }}
9297
./PCbuild/build.bat --experimental-jit ${{ matrix.debug && '-d' || '--pgo' }} -p ${{ matrix.architecture }}
9398
./PCbuild/rt.bat ${{ matrix.debug && '-d' }} -p ${{ matrix.architecture }} -q --exclude ${{ matrix.exclude }} --multiprocess 0 --timeout 3600 --verbose2 --verbose3
9499
95-
- 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
96108
if: runner.os == 'macOS'
97109
run: |
98110
brew install llvm@${{ matrix.llvm }}
99-
export SDKROOT="$(xcrun --show-sdk-path)"
100-
./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' }}
101113
make all --jobs 4
102114
./python.exe -m test --exclude ${{ matrix.exclude }} --multiprocess 0 --timeout 3600 --verbose2 --verbose3
103115
@@ -122,10 +134,10 @@ jobs:
122134
sudo apt install --yes "gcc-$HOST" qemu-user
123135
${{ !matrix.debug && matrix.compiler == 'clang' && './configure --enable-optimizations' || '' }}
124136
${{ !matrix.debug && matrix.compiler == 'clang' && 'make profile-run-stamp --jobs 4' || '' }}
125-
export CC="${{ matrix.compiler == 'clang' && 'clang --target=$HOST' || '$HOST-gcc' }}"
126-
export CPP="$CC --preprocess"
127-
export HOSTRUNNER=qemu-${{ matrix.architecture }}
128137
export QEMU_LD_PREFIX="/usr/$HOST"
129-
./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
130142
make all --jobs 4
131143
./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 }}

.github/workflows/reusable-macos.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ on:
88
required: false
99
type: boolean
1010
default: false
11+
os-matrix:
12+
required: false
13+
type: string
1114

1215
jobs:
1316
build_macos:
@@ -17,14 +20,12 @@ jobs:
1720
HOMEBREW_NO_ANALYTICS: 1
1821
HOMEBREW_NO_AUTO_UPDATE: 1
1922
HOMEBREW_NO_INSTALL_CLEANUP: 1
23+
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1
2024
PYTHONSTRICTEXTENSIONBUILD: 1
2125
strategy:
2226
fail-fast: false
2327
matrix:
24-
os: [
25-
"macos-14", # M1
26-
"macos-13", # Intel
27-
]
28+
os: ${{fromJson(inputs.os-matrix)}}
2829
runs-on: ${{ matrix.os }}
2930
steps:
3031
- uses: actions/checkout@v4
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
on:
2+
workflow_call:
3+
inputs:
4+
config_hash:
5+
required: true
6+
type: string
7+
options:
8+
required: true
9+
type: string
10+
11+
jobs:
12+
build_tsan_reusable:
13+
name: 'Thread sanitizer'
14+
runs-on: ubuntu-22.04
15+
timeout-minutes: 60
16+
steps:
17+
- uses: actions/checkout@v4
18+
- name: Runner image version
19+
run: echo "IMAGE_VERSION=${ImageVersion}" >> $GITHUB_ENV
20+
- name: Restore config.cache
21+
uses: actions/cache@v4
22+
with:
23+
path: config.cache
24+
key: ${{ github.job }}-${{ runner.os }}-${{ env.IMAGE_VERSION }}-${{ inputs.config_hash }}
25+
- name: Install Dependencies
26+
run: |
27+
sudo ./.github/workflows/posix-deps-apt.sh
28+
sudo apt install -y clang
29+
# Reduce ASLR to avoid TSAN crashing
30+
sudo sysctl -w vm.mmap_rnd_bits=28
31+
- name: TSAN Option Setup
32+
run: |
33+
echo "TSAN_OPTIONS=suppressions=${GITHUB_WORKSPACE}/Tools/tsan/supressions.txt" >> $GITHUB_ENV
34+
echo "CC=clang" >> $GITHUB_ENV
35+
echo "CXX=clang++" >> $GITHUB_ENV
36+
- name: Add ccache to PATH
37+
run: |
38+
echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV
39+
- name: Configure ccache action
40+
uses: hendrikmuhs/[email protected]
41+
with:
42+
save: ${{ github.event_name == 'push' }}
43+
max-size: "200M"
44+
- name: Configure CPython
45+
run: ${{ inputs.options }}
46+
- name: Build CPython
47+
run: make -j4
48+
- name: Display build info
49+
run: make pythoninfo
50+
- name: Tests
51+
run: ./python -m test --tsan -j4

0 commit comments

Comments
 (0)