Skip to content

Commit fd17cb6

Browse files
authored
Merge branch 'python:main' into update-documentation-on-excluded-headers-in-Python-h
2 parents ea3c013 + 5f9e38f commit fd17cb6

File tree

110 files changed

+4636
-2407
lines changed

Some content is hidden

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

110 files changed

+4636
-2407
lines changed

.github/workflows/build.yml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -585,31 +585,31 @@ jobs:
585585
- name: Tests
586586
run: xvfb-run make ci
587587

588-
build-tsan:
589-
name: >-
590-
Thread sanitizer
591-
${{ fromJSON(matrix.free-threading) && '(free-threading)' || '' }}
588+
build-san:
589+
name: >- # ${{ '' } is a hack to nest jobs under the same sidebar category
590+
Sanitizers${{ '' }}
592591
needs: build-context
593592
if: needs.build-context.outputs.run-tests == 'true'
594593
strategy:
595594
fail-fast: false
596595
matrix:
596+
check-name:
597+
- Thread
597598
free-threading:
598599
- false
599600
- true
600-
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
601608
with:
609+
sanitizer: ${{ matrix.sanitizer }}
602610
config_hash: ${{ needs.build-context.outputs.config-hash }}
603611
free-threading: ${{ matrix.free-threading }}
604612

605-
build-ubsan:
606-
name: Undefined behavior sanitizer
607-
needs: build-context
608-
if: needs.build-context.outputs.run-tests == 'true'
609-
uses: ./.github/workflows/reusable-ubsan.yml
610-
with:
611-
config_hash: ${{ needs.build-context.outputs.config-hash }}
612-
613613
cross-build-linux:
614614
name: Cross build Linux
615615
runs-on: ubuntu-latest
@@ -708,7 +708,7 @@ jobs:
708708
- build-wasi
709709
- test-hypothesis
710710
- build-asan
711-
- build-tsan
711+
- build-san
712712
- cross-build-linux
713713
- cifuzz
714714
if: always()
@@ -743,7 +743,7 @@ jobs:
743743
build-wasi,
744744
test-hypothesis,
745745
build-asan,
746-
build-tsan,
746+
build-san,
747747
cross-build-linux,
748748
'
749749
|| ''

.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/[email protected]
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

.github/workflows/reusable-tsan.yml

Lines changed: 0 additions & 94 deletions
This file was deleted.

.github/workflows/reusable-ubsan.yml

Lines changed: 0 additions & 74 deletions
This file was deleted.

Doc/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ venv:
170170
echo "venv already exists."; \
171171
echo "To recreate it, remove it first with \`make clean-venv'."; \
172172
else \
173+
set -e; \
173174
echo "Creating venv in $(VENVDIR)"; \
174175
if $(UV) --version >/dev/null 2>&1; then \
175176
$(UV) venv --python=$(PYTHON) $(VENVDIR); \

Doc/deprecations/pending-removal-in-3.15.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ Pending removal in Python 3.15
4545

4646
* :mod:`pathlib`:
4747

48-
* :meth:`.PurePath.is_reserved`
48+
* :meth:`!.PurePath.is_reserved`
4949
has been deprecated since Python 3.13.
5050
Use :func:`os.path.isreserved` to detect reserved paths on Windows.
5151

Doc/howto/logging.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -302,10 +302,10 @@ reading the following sections. If you're ready for that, grab some of your
302302
favourite beverage and carry on.
303303

304304
If your logging needs are simple, then use the above examples to incorporate
305-
logging into your own scripts, and if you run into problems or don't
306-
understand something, please post a question on the comp.lang.python Usenet
307-
group (available at https://groups.google.com/g/comp.lang.python) and you
308-
should receive help before too long.
305+
logging into your own scripts, and if you run into problems or don't understand
306+
something, please post a question in the Help category of the `Python
307+
discussion forum <https://discuss.python.org/c/help/7>`_ and you should receive
308+
help before too long.
309309

310310
Still here? You can carry on reading the next few sections, which provide a
311311
slightly more advanced/in-depth tutorial than the basic one above. After that,

0 commit comments

Comments
 (0)