Skip to content

Commit 53a50eb

Browse files
committed
Merge branch 'main' into tier-2-tos-caching
2 parents 9438c19 + 9c7b2af commit 53a50eb

File tree

613 files changed

+16835
-6103
lines changed

Some content is hidden

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

613 files changed

+16835
-6103
lines changed

.editorconfig

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

3-
[*.{py,c,cpp,h,js,rst,md,yml,yaml}]
3+
[*.{py,c,cpp,h,js,rst,md,yml,yaml,gram}]
44
trim_trailing_whitespace = true
55
insert_final_newline = true
66
indent_style = space
77

8-
[*.{py,c,cpp,h}]
8+
[*.{py,c,cpp,h,gram}]
99
indent_size = 4
1010

1111
[*.rst]

.github/CODEOWNERS

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ Modules/Setup* @erlend-aasland
2626
**/*context* @1st1
2727
**/*genobject* @markshannon
2828
**/*hamt* @1st1
29-
**/*jit* @brandtbucher @savannahostrowski
29+
**/*jit* @brandtbucher @savannahostrowski @diegorusso
30+
Python/perf_jit_trampoline.c # Exclude the owners of "**/*jit*", above.
3031
Objects/set* @rhettinger
3132
Objects/dict* @methane @markshannon
3233
Objects/typevarobject.c @JelleZijlstra

.github/workflows/build.yml

Lines changed: 97 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ jobs:
260260
free-threading: ${{ matrix.free-threading }}
261261
os: ${{ matrix.os }}
262262

263-
build-ubuntu-ssltests:
263+
build-ubuntu-ssltests-openssl:
264264
name: 'Ubuntu SSL tests with OpenSSL'
265265
runs-on: ${{ matrix.os }}
266266
timeout-minutes: 60
@@ -322,6 +322,81 @@ jobs:
322322
- name: SSL tests
323323
run: ./python Lib/test/ssltests.py
324324

325+
build-ubuntu-ssltests-awslc:
326+
name: 'Ubuntu SSL tests with AWS-LC'
327+
runs-on: ${{ matrix.os }}
328+
timeout-minutes: 60
329+
needs: build-context
330+
if: needs.build-context.outputs.run-tests == 'true'
331+
strategy:
332+
fail-fast: false
333+
matrix:
334+
os: [ubuntu-24.04]
335+
awslc_ver: [1.55.0]
336+
env:
337+
AWSLC_VER: ${{ matrix.awslc_ver}}
338+
MULTISSL_DIR: ${{ github.workspace }}/multissl
339+
OPENSSL_DIR: ${{ github.workspace }}/multissl/aws-lc/${{ matrix.awslc_ver }}
340+
LD_LIBRARY_PATH: ${{ github.workspace }}/multissl/aws-lc/${{ matrix.awslc_ver }}/lib
341+
steps:
342+
- uses: actions/checkout@v4
343+
with:
344+
persist-credentials: false
345+
- name: Runner image version
346+
run: echo "IMAGE_OS_VERSION=${ImageOS}-${ImageVersion}" >> "$GITHUB_ENV"
347+
- name: Restore config.cache
348+
uses: actions/cache@v4
349+
with:
350+
path: config.cache
351+
key: ${{ github.job }}-${{ env.IMAGE_OS_VERSION }}-${{ needs.build-context.outputs.config-hash }}
352+
- name: Register gcc problem matcher
353+
run: echo "::add-matcher::.github/problem-matchers/gcc.json"
354+
- name: Install dependencies
355+
run: sudo ./.github/workflows/posix-deps-apt.sh
356+
- name: Configure SSL lib env vars
357+
run: |
358+
echo "MULTISSL_DIR=${GITHUB_WORKSPACE}/multissl" >> "$GITHUB_ENV"
359+
echo "OPENSSL_DIR=${GITHUB_WORKSPACE}/multissl/aws-lc/${AWSLC_VER}" >> "$GITHUB_ENV"
360+
echo "LD_LIBRARY_PATH=${GITHUB_WORKSPACE}/multissl/aws-lc/${AWSLC_VER}/lib" >> "$GITHUB_ENV"
361+
- name: 'Restore AWS-LC build'
362+
id: cache-aws-lc
363+
uses: actions/cache@v4
364+
with:
365+
path: ./multissl/aws-lc/${{ matrix.awslc_ver }}
366+
key: ${{ matrix.os }}-multissl-aws-lc-${{ matrix.awslc_ver }}
367+
- name: Install AWS-LC
368+
if: steps.cache-aws-lc.outputs.cache-hit != 'true'
369+
run: |
370+
python3 Tools/ssl/multissltests.py \
371+
--steps=library \
372+
--base-directory "$MULTISSL_DIR" \
373+
--awslc ${{ matrix.awslc_ver }} \
374+
--system Linux
375+
- name: Add ccache to PATH
376+
run: |
377+
echo "PATH=/usr/lib/ccache:$PATH" >> "$GITHUB_ENV"
378+
- name: Configure ccache action
379+
uses: hendrikmuhs/ccache-action@v1.2
380+
with:
381+
save: false
382+
- name: Configure CPython
383+
run: |
384+
./configure CFLAGS="-fdiagnostics-format=json" \
385+
--config-cache \
386+
--enable-slower-safety \
387+
--with-pydebug \
388+
--with-openssl="$OPENSSL_DIR" \
389+
--with-builtin-hashlib-hashes=blake2 \
390+
--with-ssl-default-suites=openssl
391+
- name: Build CPython
392+
run: make -j
393+
- name: Display build info
394+
run: make pythoninfo
395+
- name: Verify python is linked to AWS-LC
396+
run: ./python -c 'import ssl; print(ssl.OPENSSL_VERSION)' | grep AWS-LC
397+
- name: SSL tests
398+
run: ./python Lib/test/ssltests.py
399+
325400
build-wasi:
326401
name: 'WASI'
327402
needs: build-context
@@ -510,31 +585,31 @@ jobs:
510585
- name: Tests
511586
run: xvfb-run make ci
512587

513-
build-tsan:
514-
name: >-
515-
Thread sanitizer
516-
${{ fromJSON(matrix.free-threading) && '(free-threading)' || '' }}
588+
build-san:
589+
name: >- # ${{ '' } is a hack to nest jobs under the same sidebar category
590+
Sanitizers${{ '' }}
517591
needs: build-context
518592
if: needs.build-context.outputs.run-tests == 'true'
519593
strategy:
520594
fail-fast: false
521595
matrix:
596+
check-name:
597+
- Thread
522598
free-threading:
523599
- false
524600
- true
525-
uses: ./.github/workflows/reusable-tsan.yml
601+
sanitizer:
602+
- TSan
603+
include:
604+
- check-name: Undefined behavior
605+
sanitizer: UBSan
606+
free-threading: false
607+
uses: ./.github/workflows/reusable-san.yml
526608
with:
609+
sanitizer: ${{ matrix.sanitizer }}
527610
config_hash: ${{ needs.build-context.outputs.config-hash }}
528611
free-threading: ${{ matrix.free-threading }}
529612

530-
build-ubsan:
531-
name: Undefined behavior sanitizer
532-
needs: build-context
533-
if: needs.build-context.outputs.run-tests == 'true'
534-
uses: ./.github/workflows/reusable-ubsan.yml
535-
with:
536-
config_hash: ${{ needs.build-context.outputs.config-hash }}
537-
538613
cross-build-linux:
539614
name: Cross build Linux
540615
runs-on: ubuntu-latest
@@ -628,11 +703,12 @@ jobs:
628703
- build-windows-msi
629704
- build-macos
630705
- build-ubuntu
631-
- build-ubuntu-ssltests
706+
- build-ubuntu-ssltests-awslc
707+
- build-ubuntu-ssltests-openssl
632708
- build-wasi
633709
- test-hypothesis
634710
- build-asan
635-
- build-tsan
711+
- build-san
636712
- cross-build-linux
637713
- cifuzz
638714
if: always()
@@ -643,7 +719,8 @@ jobs:
643719
with:
644720
allowed-failures: >-
645721
build-windows-msi,
646-
build-ubuntu-ssltests,
722+
build-ubuntu-ssltests-awslc,
723+
build-ubuntu-ssltests-openssl,
647724
test-hypothesis,
648725
cifuzz,
649726
allowed-skips: >-
@@ -661,11 +738,12 @@ jobs:
661738
check-generated-files,
662739
build-macos,
663740
build-ubuntu,
664-
build-ubuntu-ssltests,
741+
build-ubuntu-ssltests-awslc,
742+
build-ubuntu-ssltests-openssl,
665743
build-wasi,
666744
test-hypothesis,
667745
build-asan,
668-
build-tsan,
746+
build-san,
669747
cross-build-linux,
670748
'
671749
|| ''

.github/workflows/jit.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ on:
55
- '**jit**'
66
- 'Python/bytecodes.c'
77
- 'Python/optimizer*.c'
8+
- 'Python/executor_cases.c.h'
9+
- 'Python/optimizer_cases.c.h'
810
- '!Python/perf_jit_trampoline.c'
911
- '!**/*.md'
1012
- '!**/*.ini'
@@ -13,6 +15,8 @@ on:
1315
- '**jit**'
1416
- 'Python/bytecodes.c'
1517
- 'Python/optimizer*.c'
18+
- 'Python/executor_cases.c.h'
19+
- 'Python/optimizer_cases.c.h'
1620
- '!Python/perf_jit_trampoline.c'
1721
- '!**/*.md'
1822
- '!**/*.ini'

.github/workflows/posix-deps-apt.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ apt-get -yq install \
55
build-essential \
66
pkg-config \
77
ccache \
8+
cmake \
89
gdb \
910
lcov \
1011
libb2-dev \
@@ -25,3 +26,10 @@ apt-get -yq install \
2526
uuid-dev \
2627
xvfb \
2728
zlib1g-dev
29+
30+
# Workaround missing libmpdec-dev on ubuntu 24.04:
31+
# https://launchpad.net/~ondrej/+archive/ubuntu/php
32+
# https://deb.sury.org/
33+
sudo add-apt-repository ppa:ondrej/php
34+
apt-get update
35+
apt-get -yq install libmpdec-dev

.github/workflows/reusable-docs.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ jobs:
6666
run: |
6767
set -Eeuo pipefail
6868
# Build docs with the nit-picky option; write warnings to file
69-
make -C Doc/ PYTHON=../python SPHINXOPTS="--quiet --nitpicky --fail-on-warning --warning-file sphinx-warnings.txt" html
69+
make -C Doc/ PYTHON=../python SPHINXOPTS="--quiet --nitpicky --warning-file sphinx-warnings.txt" html
7070
- name: 'Check warnings'
7171
if: github.event_name == 'pull_request'
7272
run: |
@@ -75,6 +75,18 @@ jobs:
7575
--fail-if-regression \
7676
--fail-if-improved \
7777
--fail-if-new-news-nit
78+
- name: 'Build EPUB documentation'
79+
continue-on-error: true
80+
run: |
81+
set -Eeuo pipefail
82+
make -C Doc/ PYTHON=../python SPHINXOPTS="--quiet" epub
83+
pip install epubcheck
84+
epubcheck Doc/build/epub/Python.epub &> Doc/epubcheck.txt
85+
- name: 'Check for fatal errors in EPUB'
86+
if: github.event_name == 'pull_request'
87+
continue-on-error: true # until gh-136155 is fixed
88+
run: |
89+
python Doc/tools/check-epub.py
7890
7991
# Run "doctest" on HEAD as new syntax doesn't exist in the latest stable release
8092
doctest:

.github/workflows/reusable-san.yml

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
name: Reusable Sanitizer
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
sanitizer:
7+
required: true
8+
type: string
9+
config_hash:
10+
required: true
11+
type: string
12+
free-threading:
13+
description: Whether to use free-threaded mode
14+
required: false
15+
type: boolean
16+
default: false
17+
18+
env:
19+
FORCE_COLOR: 1
20+
21+
jobs:
22+
build-san-reusable:
23+
name: >-
24+
${{ inputs.sanitizer }}${{
25+
inputs.free-threading
26+
&& ' (free-threading)'
27+
|| ''
28+
}}
29+
runs-on: ubuntu-24.04
30+
timeout-minutes: 60
31+
steps:
32+
- uses: actions/checkout@v4
33+
with:
34+
persist-credentials: false
35+
- name: Runner image version
36+
run: echo "IMAGE_OS_VERSION=${ImageOS}-${ImageVersion}" >> "$GITHUB_ENV"
37+
- name: Restore config.cache
38+
uses: actions/cache@v4
39+
with:
40+
path: config.cache
41+
key: ${{ github.job }}-${{ env.IMAGE_OS_VERSION }}-${{ inputs.sanitizer }}-${{ inputs.config_hash }}
42+
- name: Install dependencies
43+
run: |
44+
sudo ./.github/workflows/posix-deps-apt.sh
45+
# Install clang
46+
wget https://apt.llvm.org/llvm.sh
47+
chmod +x llvm.sh
48+
49+
if [ "${SANITIZER}" = "TSan" ]; then
50+
sudo ./llvm.sh 17 # gh-121946: llvm-18 package is temporarily broken
51+
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-17 100
52+
sudo update-alternatives --set clang /usr/bin/clang-17
53+
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-17 100
54+
sudo update-alternatives --set clang++ /usr/bin/clang++-17
55+
# Reduce ASLR to avoid TSan crashing
56+
sudo sysctl -w vm.mmap_rnd_bits=28
57+
else
58+
sudo ./llvm.sh 20
59+
fi
60+
61+
- name: Sanitizer option setup
62+
run: |
63+
if [ "${SANITIZER}" = "TSan" ]; then
64+
echo "TSAN_OPTIONS=${SAN_LOG_OPTION} suppressions=${GITHUB_WORKSPACE}/Tools/tsan/suppressions${{
65+
fromJSON(inputs.free-threading)
66+
&& '_free_threading'
67+
|| ''
68+
}}.txt handle_segv=0" >> "$GITHUB_ENV"
69+
else
70+
echo "UBSAN_OPTIONS=${SAN_LOG_OPTION}" >> "$GITHUB_ENV"
71+
fi
72+
echo "CC=clang" >> "$GITHUB_ENV"
73+
echo "CXX=clang++" >> "$GITHUB_ENV"
74+
env:
75+
SANITIZER: ${{ inputs.sanitizer }}
76+
SAN_LOG_OPTION: log_path=${{ github.workspace }}/san_log
77+
- name: Add ccache to PATH
78+
run: |
79+
echo "PATH=/usr/lib/ccache:$PATH" >> "$GITHUB_ENV"
80+
- name: Configure ccache action
81+
uses: hendrikmuhs/ccache-action@v1.2
82+
with:
83+
save: ${{ github.event_name == 'push' }}
84+
max-size: "200M"
85+
- name: Configure CPython
86+
run: >-
87+
./configure
88+
--config-cache
89+
${{
90+
inputs.sanitizer == 'TSan'
91+
&& '--with-thread-sanitizer'
92+
|| '--with-undefined-behavior-sanitizer'
93+
}}
94+
--with-pydebug
95+
${{ fromJSON(inputs.free-threading) && '--disable-gil' || '' }}
96+
- name: Build CPython
97+
run: make -j4
98+
- name: Display build info
99+
run: make pythoninfo
100+
- name: Tests
101+
run: >-
102+
./python -m test
103+
${{ inputs.sanitizer == 'TSan' && '--tsan' || '' }}
104+
-j4
105+
- name: Parallel tests
106+
if: >-
107+
inputs.sanitizer == 'TSan'
108+
&& fromJSON(inputs.free-threading)
109+
run: ./python -m test --tsan-parallel --parallel-threads=4 -j4
110+
- name: Display logs
111+
if: always()
112+
run: find "${GITHUB_WORKSPACE}" -name 'san_log.*' | xargs head -n 1000
113+
- name: Archive logs
114+
if: always()
115+
uses: actions/upload-artifact@v4
116+
with:
117+
name: >-
118+
${{ inputs.sanitizer }}-logs-${{
119+
fromJSON(inputs.free-threading)
120+
&& 'free-threading'
121+
|| 'default'
122+
}}
123+
path: san_log.*
124+
if-no-files-found: ignore

0 commit comments

Comments
 (0)