Skip to content

Commit a10a1e0

Browse files
committed
Merge branch 'main' into pythongh-116380
2 parents a69a060 + 68a51e0 commit a10a1e0

File tree

186 files changed

+3227
-1811
lines changed

Some content is hidden

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

186 files changed

+3227
-1811
lines changed

.github/CODEOWNERS

+3-4
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ Objects/exceptions.c @iritkatriel
8888
**/sha* @gpshead @tiran
8989
Modules/md5* @gpshead @tiran
9090
**/*blake* @gpshead @tiran
91-
Modules/_blake2/** @gpshead @tiran
9291
Modules/_hacl/** @gpshead
9392

9493
# logging
@@ -255,8 +254,8 @@ Modules/_interp*module.c @ericsnowcurrently
255254
Lib/test/test_interpreters/ @ericsnowcurrently
256255

257256
# Android
258-
**/*Android* @mhsmith
259-
**/*android* @mhsmith
257+
**/*Android* @mhsmith @freakboy3742
258+
**/*android* @mhsmith @freakboy3742
260259

261260
# iOS (but not termios)
262261
**/iOS* @freakboy3742
@@ -267,7 +266,7 @@ Lib/test/test_interpreters/ @ericsnowcurrently
267266
**/*-ios* @freakboy3742
268267

269268
# WebAssembly
270-
/Tools/wasm/ @brettcannon
269+
/Tools/wasm/ @brettcannon @freakboy3742
271270

272271
# SBOM
273272
/Misc/externals.spdx.json @sethmlarson

.github/workflows/build.yml

+37-34
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ jobs:
5959
with:
6060
fetch-depth: 1
6161
- name: Runner image version
62-
run: echo "IMAGE_VERSION=${ImageVersion}" >> $GITHUB_ENV
62+
run: echo "IMAGE_VERSION=${ImageVersion}" >> "$GITHUB_ENV"
6363
- name: Check Autoconf and aclocal versions
6464
run: |
6565
grep "Generated by GNU Autoconf 2.71" configure
@@ -98,7 +98,7 @@ jobs:
9898
with:
9999
python-version: '3.x'
100100
- name: Runner image version
101-
run: echo "IMAGE_VERSION=${ImageVersion}" >> $GITHUB_ENV
101+
run: echo "IMAGE_VERSION=${ImageVersion}" >> "$GITHUB_ENV"
102102
- name: Restore config.cache
103103
uses: actions/cache@v4
104104
with:
@@ -108,7 +108,7 @@ jobs:
108108
- name: Install Dependencies
109109
run: sudo ./.github/workflows/posix-deps-apt.sh
110110
- name: Add ccache to PATH
111-
run: echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV
111+
run: echo "PATH=/usr/lib/ccache:$PATH" >> "$GITHUB_ENV"
112112
- name: Configure ccache action
113113
uses: hendrikmuhs/ccache-action@v1.2
114114
with:
@@ -247,7 +247,7 @@ jobs:
247247
steps:
248248
- uses: actions/checkout@v4
249249
- name: Runner image version
250-
run: echo "IMAGE_VERSION=${ImageVersion}" >> $GITHUB_ENV
250+
run: echo "IMAGE_VERSION=${ImageVersion}" >> "$GITHUB_ENV"
251251
- name: Restore config.cache
252252
uses: actions/cache@v4
253253
with:
@@ -259,9 +259,9 @@ jobs:
259259
run: sudo ./.github/workflows/posix-deps-apt.sh
260260
- name: Configure OpenSSL env vars
261261
run: |
262-
echo "MULTISSL_DIR=${GITHUB_WORKSPACE}/multissl" >> $GITHUB_ENV
263-
echo "OPENSSL_DIR=${GITHUB_WORKSPACE}/multissl/openssl/${OPENSSL_VER}" >> $GITHUB_ENV
264-
echo "LD_LIBRARY_PATH=${GITHUB_WORKSPACE}/multissl/openssl/${OPENSSL_VER}/lib" >> $GITHUB_ENV
262+
echo "MULTISSL_DIR=${GITHUB_WORKSPACE}/multissl" >> "$GITHUB_ENV"
263+
echo "OPENSSL_DIR=${GITHUB_WORKSPACE}/multissl/openssl/${OPENSSL_VER}" >> "$GITHUB_ENV"
264+
echo "LD_LIBRARY_PATH=${GITHUB_WORKSPACE}/multissl/openssl/${OPENSSL_VER}/lib" >> "$GITHUB_ENV"
265265
- name: 'Restore OpenSSL build'
266266
id: cache-openssl
267267
uses: actions/cache@v4
@@ -270,16 +270,16 @@ jobs:
270270
key: ${{ matrix.os }}-multissl-openssl-${{ env.OPENSSL_VER }}
271271
- name: Install OpenSSL
272272
if: steps.cache-openssl.outputs.cache-hit != 'true'
273-
run: python3 Tools/ssl/multissltests.py --steps=library --base-directory $MULTISSL_DIR --openssl $OPENSSL_VER --system Linux
273+
run: python3 Tools/ssl/multissltests.py --steps=library --base-directory "$MULTISSL_DIR" --openssl "$OPENSSL_VER" --system Linux
274274
- name: Add ccache to PATH
275275
run: |
276-
echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV
276+
echo "PATH=/usr/lib/ccache:$PATH" >> "$GITHUB_ENV"
277277
- name: Configure ccache action
278278
uses: hendrikmuhs/ccache-action@v1.2
279279
with:
280280
save: false
281281
- name: Configure CPython
282-
run: ./configure CFLAGS="-fdiagnostics-format=json" --config-cache --enable-slower-safety --with-pydebug --with-openssl=$OPENSSL_DIR
282+
run: ./configure CFLAGS="-fdiagnostics-format=json" --config-cache --enable-slower-safety --with-pydebug --with-openssl="$OPENSSL_DIR"
283283
- name: Build CPython
284284
run: make -j4
285285
- name: Display build info
@@ -312,9 +312,9 @@ jobs:
312312
run: sudo ./.github/workflows/posix-deps-apt.sh
313313
- name: Configure OpenSSL env vars
314314
run: |
315-
echo "MULTISSL_DIR=${GITHUB_WORKSPACE}/multissl" >> $GITHUB_ENV
316-
echo "OPENSSL_DIR=${GITHUB_WORKSPACE}/multissl/openssl/${OPENSSL_VER}" >> $GITHUB_ENV
317-
echo "LD_LIBRARY_PATH=${GITHUB_WORKSPACE}/multissl/openssl/${OPENSSL_VER}/lib" >> $GITHUB_ENV
315+
echo "MULTISSL_DIR=${GITHUB_WORKSPACE}/multissl" >> "$GITHUB_ENV"
316+
echo "OPENSSL_DIR=${GITHUB_WORKSPACE}/multissl/openssl/${OPENSSL_VER}" >> "$GITHUB_ENV"
317+
echo "LD_LIBRARY_PATH=${GITHUB_WORKSPACE}/multissl/openssl/${OPENSSL_VER}/lib" >> "$GITHUB_ENV"
318318
- name: 'Restore OpenSSL build'
319319
id: cache-openssl
320320
uses: actions/cache@v4
@@ -323,24 +323,24 @@ jobs:
323323
key: ${{ runner.os }}-multissl-openssl-${{ env.OPENSSL_VER }}
324324
- name: Install OpenSSL
325325
if: steps.cache-openssl.outputs.cache-hit != 'true'
326-
run: python3 Tools/ssl/multissltests.py --steps=library --base-directory $MULTISSL_DIR --openssl $OPENSSL_VER --system Linux
326+
run: python3 Tools/ssl/multissltests.py --steps=library --base-directory "$MULTISSL_DIR" --openssl "$OPENSSL_VER" --system Linux
327327
- name: Add ccache to PATH
328328
run: |
329-
echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV
329+
echo "PATH=/usr/lib/ccache:$PATH" >> "$GITHUB_ENV"
330330
- name: Configure ccache action
331331
uses: hendrikmuhs/ccache-action@v1.2
332332
with:
333333
save: false
334334
- name: Setup directory envs for out-of-tree builds
335335
run: |
336-
echo "CPYTHON_RO_SRCDIR=$(realpath -m ${GITHUB_WORKSPACE}/../cpython-ro-srcdir)" >> $GITHUB_ENV
337-
echo "CPYTHON_BUILDDIR=$(realpath -m ${GITHUB_WORKSPACE}/../cpython-builddir)" >> $GITHUB_ENV
336+
echo "CPYTHON_RO_SRCDIR=$(realpath -m "${GITHUB_WORKSPACE}"/../cpython-ro-srcdir)" >> "$GITHUB_ENV"
337+
echo "CPYTHON_BUILDDIR=$(realpath -m "${GITHUB_WORKSPACE}"/../cpython-builddir)" >> "$GITHUB_ENV"
338338
- name: Create directories for read-only out-of-tree builds
339-
run: mkdir -p $CPYTHON_RO_SRCDIR $CPYTHON_BUILDDIR
339+
run: mkdir -p "$CPYTHON_RO_SRCDIR" "$CPYTHON_BUILDDIR"
340340
- name: Bind mount sources read-only
341-
run: sudo mount --bind -o ro $GITHUB_WORKSPACE $CPYTHON_RO_SRCDIR
341+
run: sudo mount --bind -o ro "$GITHUB_WORKSPACE" "$CPYTHON_RO_SRCDIR"
342342
- name: Runner image version
343-
run: echo "IMAGE_VERSION=${ImageVersion}" >> $GITHUB_ENV
343+
run: echo "IMAGE_VERSION=${ImageVersion}" >> "$GITHUB_ENV"
344344
- name: Restore config.cache
345345
uses: actions/cache@v4
346346
with:
@@ -353,7 +353,7 @@ jobs:
353353
--config-cache \
354354
--with-pydebug \
355355
--enable-slower-safety \
356-
--with-openssl=$OPENSSL_DIR
356+
--with-openssl="$OPENSSL_DIR"
357357
- name: Build CPython out-of-tree
358358
working-directory: ${{ env.CPYTHON_BUILDDIR }}
359359
run: make -j4
@@ -362,18 +362,18 @@ jobs:
362362
run: make pythoninfo
363363
- name: Remount sources writable for tests
364364
# some tests write to srcdir, lack of pyc files slows down testing
365-
run: sudo mount $CPYTHON_RO_SRCDIR -oremount,rw
365+
run: sudo mount "$CPYTHON_RO_SRCDIR" -oremount,rw
366366
- name: Setup directory envs for out-of-tree builds
367367
run: |
368-
echo "CPYTHON_BUILDDIR=$(realpath -m ${GITHUB_WORKSPACE}/../cpython-builddir)" >> $GITHUB_ENV
368+
echo "CPYTHON_BUILDDIR=$(realpath -m "${GITHUB_WORKSPACE}"/../cpython-builddir)" >> "$GITHUB_ENV"
369369
- name: "Create hypothesis venv"
370370
working-directory: ${{ env.CPYTHON_BUILDDIR }}
371371
run: |
372372
VENV_LOC=$(realpath -m .)/hypovenv
373373
VENV_PYTHON=$VENV_LOC/bin/python
374-
echo "HYPOVENV=${VENV_LOC}" >> $GITHUB_ENV
375-
echo "VENV_PYTHON=${VENV_PYTHON}" >> $GITHUB_ENV
376-
./python -m venv $VENV_LOC && $VENV_PYTHON -m pip install -r ${GITHUB_WORKSPACE}/Tools/requirements-hypothesis.txt
374+
echo "HYPOVENV=${VENV_LOC}" >> "$GITHUB_ENV"
375+
echo "VENV_PYTHON=${VENV_PYTHON}" >> "$GITHUB_ENV"
376+
./python -m venv "$VENV_LOC" && "$VENV_PYTHON" -m pip install -r "${GITHUB_WORKSPACE}/Tools/requirements-hypothesis.txt"
377377
- name: 'Restore Hypothesis database'
378378
id: cache-hypothesis-database
379379
uses: actions/cache@v4
@@ -411,18 +411,21 @@ jobs:
411411

412412
build_asan:
413413
name: 'Address sanitizer'
414-
runs-on: ubuntu-22.04
414+
runs-on: ${{ matrix.os }}
415415
timeout-minutes: 60
416416
needs: check_source
417417
if: needs.check_source.outputs.run_tests == 'true'
418+
strategy:
419+
matrix:
420+
os: [ubuntu-22.04]
418421
env:
419422
OPENSSL_VER: 3.0.15
420423
PYTHONSTRICTEXTENSIONBUILD: 1
421424
ASAN_OPTIONS: detect_leaks=0:allocator_may_return_null=1:handle_segv=0
422425
steps:
423426
- uses: actions/checkout@v4
424427
- name: Runner image version
425-
run: echo "IMAGE_VERSION=${ImageVersion}" >> $GITHUB_ENV
428+
run: echo "IMAGE_VERSION=${ImageVersion}" >> "$GITHUB_ENV"
426429
- name: Restore config.cache
427430
uses: actions/cache@v4
428431
with:
@@ -438,9 +441,9 @@ jobs:
438441
version: 10
439442
- name: Configure OpenSSL env vars
440443
run: |
441-
echo "MULTISSL_DIR=${GITHUB_WORKSPACE}/multissl" >> $GITHUB_ENV
442-
echo "OPENSSL_DIR=${GITHUB_WORKSPACE}/multissl/openssl/${OPENSSL_VER}" >> $GITHUB_ENV
443-
echo "LD_LIBRARY_PATH=${GITHUB_WORKSPACE}/multissl/openssl/${OPENSSL_VER}/lib" >> $GITHUB_ENV
444+
echo "MULTISSL_DIR=${GITHUB_WORKSPACE}/multissl" >> "$GITHUB_ENV"
445+
echo "OPENSSL_DIR=${GITHUB_WORKSPACE}/multissl/openssl/${OPENSSL_VER}" >> "$GITHUB_ENV"
446+
echo "LD_LIBRARY_PATH=${GITHUB_WORKSPACE}/multissl/openssl/${OPENSSL_VER}/lib" >> "$GITHUB_ENV"
444447
- name: 'Restore OpenSSL build'
445448
id: cache-openssl
446449
uses: actions/cache@v4
@@ -449,10 +452,10 @@ jobs:
449452
key: ${{ matrix.os }}-multissl-openssl-${{ env.OPENSSL_VER }}
450453
- name: Install OpenSSL
451454
if: steps.cache-openssl.outputs.cache-hit != 'true'
452-
run: python3 Tools/ssl/multissltests.py --steps=library --base-directory $MULTISSL_DIR --openssl $OPENSSL_VER --system Linux
455+
run: python3 Tools/ssl/multissltests.py --steps=library --base-directory "$MULTISSL_DIR" --openssl "$OPENSSL_VER" --system Linux
453456
- name: Add ccache to PATH
454457
run: |
455-
echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV
458+
echo "PATH=/usr/lib/ccache:$PATH" >> "$GITHUB_ENV"
456459
- name: Configure ccache action
457460
uses: hendrikmuhs/ccache-action@v1.2
458461
with:
@@ -465,7 +468,7 @@ jobs:
465468
- name: Display build info
466469
run: make pythoninfo
467470
- name: Tests
468-
run: xvfb-run make test
471+
run: xvfb-run make ci
469472

470473
build_tsan:
471474
name: 'Thread sanitizer'

.github/workflows/jit.yml

+12-3
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ jobs:
6161
- true
6262
- false
6363
llvm:
64-
- 18
64+
- 19
6565
include:
6666
- target: i686-pc-windows-msvc/msvc
6767
architecture: Win32
@@ -121,10 +121,15 @@ jobs:
121121
choco install llvm --allow-downgrade --no-progress --version ${{ matrix.llvm }}.1.0
122122
./PCbuild/build.bat --experimental-jit ${{ matrix.debug && '-d' || '' }} -p ${{ matrix.architecture }}
123123
124+
# The `find` line is required as a result of https://github.com/actions/runner-images/issues/9966.
125+
# This is a bug in the macOS runner image where the pre-installed Python is installed in the same
126+
# directory as the Homebrew Python, which causes the build to fail for macos-13. This line removes
127+
# the symlink to the pre-installed Python so that the Homebrew Python is used instead.
124128
- name: Native macOS
125129
if: runner.os == 'macOS'
126130
run: |
127131
brew update
132+
find /usr/local/bin -lname '*/Library/Frameworks/Python.framework/*' -delete
128133
brew install llvm@${{ matrix.llvm }}
129134
SDKROOT="$(xcrun --show-sdk-path)" \
130135
./configure --enable-experimental-jit ${{ matrix.debug && '--with-pydebug' || '--enable-optimizations --with-lto' }}
@@ -165,15 +170,19 @@ jobs:
165170
name: Free-Threaded (Debug)
166171
needs: interpreter
167172
runs-on: ubuntu-latest
173+
strategy:
174+
matrix:
175+
llvm:
176+
- 19
168177
steps:
169178
- uses: actions/checkout@v4
170179
- uses: actions/setup-python@v5
171180
with:
172181
python-version: '3.11'
173182
- name: Build with JIT enabled and GIL disabled
174183
run: |
175-
sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)" ./llvm.sh 18
176-
export PATH="$(llvm-config-18 --bindir):$PATH"
184+
sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)" ./llvm.sh ${{ matrix.llvm }}
185+
export PATH="$(llvm-config-${{ matrix.llvm }} --bindir):$PATH"
177186
./configure --enable-experimental-jit --with-pydebug --disable-gil
178187
make all --jobs 4
179188
- name: Run tests

.github/workflows/require-pr-label.yml

+42-4
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,53 @@ permissions:
99
pull-requests: write
1010

1111
jobs:
12-
label:
13-
name: DO-NOT-MERGE / unresolved review
12+
label-dnm:
13+
name: DO-NOT-MERGE
1414
if: github.repository_owner == 'python'
1515
runs-on: ubuntu-latest
1616
timeout-minutes: 10
1717

1818
steps:
19-
- uses: mheap/github-action-required-labels@v5
19+
- name: Check there's no DO-NOT-MERGE
20+
uses: mheap/github-action-required-labels@v5
2021
with:
2122
mode: exactly
2223
count: 0
23-
labels: "DO-NOT-MERGE, awaiting changes, awaiting change review"
24+
labels: |
25+
DO-NOT-MERGE
26+
27+
label-reviews:
28+
name: Unresolved review
29+
if: github.repository_owner == 'python'
30+
runs-on: ubuntu-latest
31+
timeout-minutes: 10
32+
33+
steps:
34+
# Check that the PR is not awaiting changes from the author due to previous review.
35+
- name: Check there's no required changes
36+
uses: mheap/github-action-required-labels@v5
37+
with:
38+
mode: exactly
39+
count: 0
40+
labels: |
41+
awaiting changes
42+
awaiting change review
43+
- id: is-feature
44+
name: Check whether this PR is a feature (contains a "type-feature" label)
45+
uses: mheap/github-action-required-labels@v5
46+
with:
47+
mode: exactly
48+
count: 1
49+
labels: |
50+
type-feature
51+
exit_type: success # don't fail the check if the PR is not a feature, just record the result
52+
# In case of a feature PR, check for a complete review (contains an "awaiting merge" label).
53+
- id: awaiting-merge
54+
if: steps.is-feature.outputs.status == 'success'
55+
name: Check for complete review
56+
uses: mheap/github-action-required-labels@v5
57+
with:
58+
mode: exactly
59+
count: 1
60+
labels: |
61+
awaiting merge

.github/workflows/reusable-change-detection.yml

+10-10
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ jobs:
6565
id: check
6666
run: |
6767
if [ -z "$GITHUB_BASE_REF" ]; then
68-
echo "run-tests=true" >> $GITHUB_OUTPUT
68+
echo "run-tests=true" >> "$GITHUB_OUTPUT"
6969
else
70-
git fetch origin $GITHUB_BASE_REF --depth=1
70+
git fetch origin "$GITHUB_BASE_REF" --depth=1
7171
# git diff "origin/$GITHUB_BASE_REF..." (3 dots) may be more
7272
# reliable than git diff "origin/$GITHUB_BASE_REF.." (2 dots),
7373
# but it requires to download more commits (this job uses
@@ -81,38 +81,38 @@ jobs:
8181
# into the PR branch anyway.
8282
#
8383
# https://github.com/python/core-workflow/issues/373
84-
git diff --name-only origin/$GITHUB_BASE_REF.. | grep -qvE '(\.rst$|^Doc|^Misc|^\.pre-commit-config\.yaml$|\.ruff\.toml$|\.md$|mypy\.ini$)' && echo "run-tests=true" >> $GITHUB_OUTPUT || true
84+
git diff --name-only "origin/$GITHUB_BASE_REF.." | grep -qvE '(\.rst$|^Doc|^Misc|^\.pre-commit-config\.yaml$|\.ruff\.toml$|\.md$|mypy\.ini$)' && echo "run-tests=true" >> "$GITHUB_OUTPUT" || true
8585
fi
8686
8787
# Check if we should run hypothesis tests
8888
GIT_BRANCH=${GITHUB_BASE_REF:-${GITHUB_REF#refs/heads/}}
89-
echo $GIT_BRANCH
89+
echo "$GIT_BRANCH"
9090
if $(echo "$GIT_BRANCH" | grep -q -w '3\.\(8\|9\|10\|11\)'); then
9191
echo "Branch too old for hypothesis tests"
92-
echo "run-hypothesis=false" >> $GITHUB_OUTPUT
92+
echo "run-hypothesis=false" >> "$GITHUB_OUTPUT"
9393
else
9494
echo "Run hypothesis tests"
95-
echo "run-hypothesis=true" >> $GITHUB_OUTPUT
95+
echo "run-hypothesis=true" >> "$GITHUB_OUTPUT"
9696
fi
9797
9898
# oss-fuzz maintains a configuration for fuzzing the main branch of
9999
# CPython, so CIFuzz should be run only for code that is likely to be
100100
# merged into the main branch; compatibility with older branches may
101101
# be broken.
102102
FUZZ_RELEVANT_FILES='(\.c$|\.h$|\.cpp$|^configure$|^\.github/workflows/build\.yml$|^Modules/_xxtestfuzz)'
103-
if [ "$GITHUB_BASE_REF" = "main" ] && [ "$(git diff --name-only origin/$GITHUB_BASE_REF.. | grep -qE $FUZZ_RELEVANT_FILES; echo $?)" -eq 0 ]; then
103+
if [ "$GITHUB_BASE_REF" = "main" ] && [ "$(git diff --name-only "origin/$GITHUB_BASE_REF.." | grep -qE $FUZZ_RELEVANT_FILES; echo $?)" -eq 0 ]; then
104104
# The tests are pretty slow so they are executed only for PRs
105105
# changing relevant files.
106106
echo "Run CIFuzz tests"
107-
echo "run-cifuzz=true" >> $GITHUB_OUTPUT
107+
echo "run-cifuzz=true" >> "$GITHUB_OUTPUT"
108108
else
109109
echo "Branch too old for CIFuzz tests; or no C files were changed"
110-
echo "run-cifuzz=false" >> $GITHUB_OUTPUT
110+
echo "run-cifuzz=false" >> "$GITHUB_OUTPUT"
111111
fi
112112
- name: Compute hash for config cache key
113113
id: config-hash
114114
run: |
115-
echo "hash=${{ hashFiles('configure', 'configure.ac', '.github/workflows/build.yml') }}" >> $GITHUB_OUTPUT
115+
echo "hash=${{ hashFiles('configure', 'configure.ac', '.github/workflows/build.yml') }}" >> "$GITHUB_OUTPUT"
116116
- name: Get a list of the changed documentation-related files
117117
if: github.event_name == 'pull_request'
118118
id: changed-docs-files

0 commit comments

Comments
 (0)