Skip to content

Commit f482eba

Browse files
authored
Merge branch 'main' into pythongh-128799
2 parents 65cf6e7 + 9012fa7 commit f482eba

File tree

358 files changed

+21578
-25007
lines changed

Some content is hidden

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

358 files changed

+21578
-25007
lines changed

.github/CODEOWNERS

+15-3
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
# https://git-scm.com/docs/gitignore#_pattern_format
66

77
# GitHub
8-
.github/** @ezio-melotti @hugovk
8+
.github/** @ezio-melotti @hugovk @AA-Turner
99

1010
# pre-commit
1111
.pre-commit-config.yaml @hugovk @AlexWaygood
12-
.ruff.toml @hugovk @AlexWaygood
12+
.ruff.toml @hugovk @AlexWaygood @AA-Turner
1313

1414
# Build system
1515
configure* @erlend-aasland @corona10
@@ -56,6 +56,14 @@ Tools/c-analyzer/ @ericsnowcurrently
5656
# dbm
5757
**/*dbm* @corona10 @erlend-aasland @serhiy-storchaka
5858

59+
# Doc/ tools
60+
Doc/conf.py @AA-Turner @hugovk
61+
Doc/Makefile @AA-Turner @hugovk
62+
Doc/make.bat @AA-Turner @hugovk
63+
Doc/requirements.txt @AA-Turner @hugovk
64+
Doc/_static/** @AA-Turner @hugovk
65+
Doc/tools/** @AA-Turner @hugovk
66+
5967
# runtime state/lifecycle
6068
**/*pylifecycle* @ericsnowcurrently
6169
**/*pystate* @ericsnowcurrently
@@ -293,6 +301,10 @@ Lib/configparser.py @jaraco
293301
Lib/test/test_configparser.py @jaraco
294302

295303
# Doc sections
296-
Doc/reference/ @willingc
304+
Doc/reference/ @willingc @AA-Turner
297305

298306
**/*weakref* @kumaraditya303
307+
308+
# Colorize
309+
Lib/_colorize.py @hugovk
310+
Lib/test/test__colorize.py @hugovk

.github/actionlint.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
self-hosted-runner:
2-
labels: ["ubuntu-24.04-aarch64", "windows-aarch64"]
2+
labels: ["windows-aarch64"]
33

44
config-variables: null
55

66
paths:
77
.github/workflows/**/*.yml:
88
ignore:
99
- 1st argument of function call is not assignable
10-
- SC2(015|038|086|091|097|098|129|155)
10+
- SC2(015|038|086|091|097|098|129|155)

.github/workflows/build.yml

+12-5
Original file line numberDiff line numberDiff line change
@@ -231,24 +231,31 @@ jobs:
231231
name: >-
232232
Ubuntu
233233
${{ fromJSON(matrix.free-threading) && '(free-threading)' || '' }}
234+
${{ fromJSON(matrix.bolt) && '(bolt)' || '' }}
234235
needs: check_source
235236
if: needs.check_source.outputs.run_tests == 'true'
236237
strategy:
237238
matrix:
239+
bolt:
240+
- false
241+
- true
238242
free-threading:
239243
- false
240244
- true
241245
os:
242246
- ubuntu-24.04
243-
- ubuntu-24.04-aarch64
244-
is-fork: # only used for the exclusion trick
245-
- ${{ github.repository_owner != 'python' }}
247+
- ubuntu-24.04-arm
246248
exclude:
247-
- os: ubuntu-24.04-aarch64
248-
is-fork: true
249+
# Do not test BOLT with free-threading, to conserve resources
250+
- bolt: true
251+
free-threading: true
252+
# BOLT currently crashes during instrumentation on aarch64
253+
- os: ubuntu-24.04-arm
254+
bolt: true
249255
uses: ./.github/workflows/reusable-ubuntu.yml
250256
with:
251257
config_hash: ${{ needs.check_source.outputs.config_hash }}
258+
bolt-optimizations: ${{ matrix.bolt }}
252259
free-threading: ${{ matrix.free-threading }}
253260
os: ${{ matrix.os }}
254261

.github/workflows/jit.yml

+2-4
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,7 @@ jobs:
8383
runner: ubuntu-24.04
8484
- target: aarch64-unknown-linux-gnu/gcc
8585
architecture: aarch64
86-
# Forks don't have access to our paid AArch64 runners. These jobs are skipped below:
87-
runner: ${{ github.repository_owner == 'python' && 'ubuntu-24.04-aarch64' || 'ubuntu-24.04' }}
86+
runner: ubuntu-24.04-arm
8887
steps:
8988
- uses: actions/checkout@v4
9089
with:
@@ -123,8 +122,7 @@ jobs:
123122
./python.exe -m test --multiprocess 0 --timeout 4500 --verbose2 --verbose3
124123
125124
- name: Native Linux
126-
# Forks don't have access to our paid AArch64 runners. Skip those:
127-
if: runner.os == 'Linux' && (matrix.architecture == 'x86_64' || github.repository_owner == 'python')
125+
if: runner.os == 'Linux'
128126
run: |
129127
sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)" ./llvm.sh ${{ matrix.llvm }}
130128
export PATH="$(llvm-config-${{ matrix.llvm }} --bindir):$PATH"

.github/workflows/reusable-docs.yml

+3-23
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ jobs:
6565
continue-on-error: true
6666
run: |
6767
set -Eeuo pipefail
68-
# Build docs with the '-n' (nit-picky) option; write warnings to file
69-
make -C Doc/ PYTHON=../python SPHINXOPTS="-q -n -W --keep-going -w sphinx-warnings.txt" html
68+
# Build docs with the nit-picky option; write warnings to file
69+
make -C Doc/ PYTHON=../python SPHINXOPTS="--quiet --nitpicky --fail-on-warning --keep-going --warning-file sphinx-warnings.txt" html
7070
- name: 'Check warnings'
7171
if: github.event_name == 'pull_request'
7272
run: |
@@ -76,26 +76,6 @@ jobs:
7676
--fail-if-improved \
7777
--fail-if-new-news-nit
7878
79-
# This build doesn't use problem matchers or check annotations
80-
build_doc_oldest_supported_sphinx:
81-
name: 'Docs (Oldest Sphinx)'
82-
runs-on: ubuntu-latest
83-
timeout-minutes: 60
84-
steps:
85-
- uses: actions/checkout@v4
86-
with:
87-
persist-credentials: false
88-
- name: 'Set up Python'
89-
uses: actions/setup-python@v5
90-
with:
91-
python-version: '3.13' # known to work with Sphinx 7.2.6
92-
cache: 'pip'
93-
cache-dependency-path: 'Doc/requirements-oldest-sphinx.txt'
94-
- name: 'Install build dependencies'
95-
run: make -C Doc/ venv REQUIREMENTS="requirements-oldest-sphinx.txt"
96-
- name: 'Build HTML documentation'
97-
run: make -C Doc/ SPHINXOPTS="-q" SPHINXERRORHANDLING="-W --keep-going" html
98-
9979
# Run "doctest" on HEAD as new syntax doesn't exist in the latest stable release
10080
doctest:
10181
name: 'Doctest'
@@ -121,4 +101,4 @@ jobs:
121101
run: make -C Doc/ PYTHON=../python venv
122102
# Use "xvfb-run" since some doctest tests open GUI windows
123103
- name: 'Run documentation doctest'
124-
run: xvfb-run make -C Doc/ PYTHON=../python SPHINXERRORHANDLING="-W --keep-going" doctest
104+
run: xvfb-run make -C Doc/ PYTHON=../python SPHINXERRORHANDLING="--fail-on-warning --keep-going" doctest

.github/workflows/reusable-ubuntu.yml

+15
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ on:
66
config_hash:
77
required: true
88
type: string
9+
bolt-optimizations:
10+
description: Whether to enable BOLT optimizations
11+
required: false
12+
type: boolean
13+
default: false
914
free-threading:
1015
description: Whether to use free-threaded mode
1116
required: false
@@ -34,6 +39,12 @@ jobs:
3439
run: echo "::add-matcher::.github/problem-matchers/gcc.json"
3540
- name: Install dependencies
3641
run: sudo ./.github/workflows/posix-deps-apt.sh
42+
- name: Install Clang and BOLT
43+
if: ${{ fromJSON(inputs.bolt-optimizations) }}
44+
run: |
45+
sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)" ./llvm.sh 19
46+
sudo apt-get install bolt-19
47+
echo PATH="$(llvm-config-19 --bindir):$PATH" >> $GITHUB_ENV
3748
- name: Configure OpenSSL env vars
3849
run: |
3950
echo "MULTISSL_DIR=${GITHUB_WORKSPACE}/multissl" >> "$GITHUB_ENV"
@@ -73,14 +84,18 @@ jobs:
7384
key: ${{ github.job }}-${{ runner.os }}-${{ env.IMAGE_VERSION }}-${{ inputs.config_hash }}
7485
- name: Configure CPython out-of-tree
7586
working-directory: ${{ env.CPYTHON_BUILDDIR }}
87+
# `test_unpickle_module_race` writes to the source directory, which is
88+
# read-only during builds — so we exclude it from profiling with BOLT.
7689
run: >-
90+
PROFILE_TASK='-m test --pgo --ignore test_unpickle_module_race'
7791
../cpython-ro-srcdir/configure
7892
--config-cache
7993
--with-pydebug
8094
--enable-slower-safety
8195
--enable-safety
8296
--with-openssl="$OPENSSL_DIR"
8397
${{ fromJSON(inputs.free-threading) && '--disable-gil' || '' }}
98+
${{ fromJSON(inputs.bolt-optimizations) && '--enable-bolt' || '' }}
8499
- name: Build CPython out-of-tree
85100
if: ${{ inputs.free-threading }}
86101
working-directory: ${{ env.CPYTHON_BUILDDIR }}

.pre-commit-config.yaml

+4-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/astral-sh/ruff-pre-commit
3-
rev: v0.8.2
3+
rev: v0.9.1
44
hooks:
55
- id: ruff
66
name: Run Ruff (lint) on Doc/
@@ -29,12 +29,10 @@ repos:
2929
- id: black
3030
name: Run Black on Tools/build/check_warnings.py
3131
files: ^Tools/build/check_warnings.py
32-
language_version: python3.12
3332
args: [--line-length=79]
3433
- id: black
3534
name: Run Black on Tools/jit/
3635
files: ^Tools/jit/
37-
language_version: python3.12
3836

3937
- repo: https://github.com/pre-commit/pre-commit-hooks
4038
rev: v5.0.0
@@ -51,19 +49,19 @@ repos:
5149
types_or: [c, inc, python, rst]
5250

5351
- repo: https://github.com/python-jsonschema/check-jsonschema
54-
rev: 0.30.0
52+
rev: 0.31.0
5553
hooks:
5654
- id: check-dependabot
5755
- id: check-github-workflows
5856
- id: check-readthedocs
5957

6058
- repo: https://github.com/rhysd/actionlint
61-
rev: v1.7.4
59+
rev: v1.7.7
6260
hooks:
6361
- id: actionlint
6462

6563
- repo: https://github.com/woodruffw/zizmor-pre-commit
66-
rev: v0.8.0
64+
rev: v1.1.1
6765
hooks:
6866
- id: zizmor
6967

Doc/Makefile

+12-12
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ PAPER =
1414
SOURCES =
1515
DISTVERSION = $(shell $(PYTHON) tools/extensions/patchlevel.py)
1616
REQUIREMENTS = requirements.txt
17-
SPHINXERRORHANDLING = -W
17+
SPHINXERRORHANDLING = --fail-on-warning
1818

1919
# Internal variables.
20-
PAPEROPT_a4 = -D latex_elements.papersize=a4paper
21-
PAPEROPT_letter = -D latex_elements.papersize=letterpaper
20+
PAPEROPT_a4 = --define latex_elements.papersize=a4paper
21+
PAPEROPT_letter = --define latex_elements.papersize=letterpaper
2222

23-
ALLSPHINXOPTS = -b $(BUILDER) \
24-
-d build/doctrees \
25-
-j $(JOBS) \
23+
ALLSPHINXOPTS = --builder $(BUILDER) \
24+
--doctree-dir build/doctrees \
25+
--jobs $(JOBS) \
2626
$(PAPEROPT_$(PAPER)) \
2727
$(SPHINXOPTS) $(SPHINXERRORHANDLING) \
2828
. build/$(BUILDER) $(SOURCES)
@@ -144,7 +144,7 @@ pydoc-topics: build
144144

145145
.PHONY: gettext
146146
gettext: BUILDER = gettext
147-
gettext: override SPHINXOPTS := -d build/doctrees-gettext $(SPHINXOPTS)
147+
gettext: override SPHINXOPTS := --doctree-dir build/doctrees-gettext $(SPHINXOPTS)
148148
gettext: build
149149

150150
.PHONY: htmlview
@@ -172,7 +172,7 @@ venv:
172172
else \
173173
echo "Creating venv in $(VENVDIR)"; \
174174
if $(UV) --version >/dev/null 2>&1; then \
175-
$(UV) venv $(VENVDIR); \
175+
$(UV) venv --python=$(PYTHON) $(VENVDIR); \
176176
VIRTUAL_ENV=$(VENVDIR) $(UV) pip install -r $(REQUIREMENTS); \
177177
else \
178178
$(PYTHON) -m venv $(VENVDIR); \
@@ -300,20 +300,20 @@ serve:
300300
# By default, Sphinx only rebuilds pages where the page content has changed.
301301
# This means it doesn't always pick up changes to preferred link targets, etc
302302
# To ensure such changes are picked up, we build the published docs with
303-
# `-E` (to ignore the cached environment) and `-a` (to ignore already existing
304-
# output files)
303+
# ``--fresh-env`` (to ignore the cached environment) and ``--write-all``
304+
# (to ignore already existing output files)
305305

306306
# for development releases: always build
307307
.PHONY: autobuild-dev
308308
autobuild-dev: DISTVERSION = $(shell $(PYTHON) tools/extensions/patchlevel.py --short)
309309
autobuild-dev:
310-
$(MAKE) dist-no-html SPHINXOPTS='$(SPHINXOPTS) -Ea -A daily=1' DISTVERSION=$(DISTVERSION)
310+
$(MAKE) dist-no-html SPHINXOPTS='$(SPHINXOPTS) --fresh-env --write-all --html-define daily=1' DISTVERSION=$(DISTVERSION)
311311

312312
# for HTML-only rebuilds
313313
.PHONY: autobuild-dev-html
314314
autobuild-dev-html: DISTVERSION = $(shell $(PYTHON) tools/extensions/patchlevel.py --short)
315315
autobuild-dev-html:
316-
$(MAKE) dist-html SPHINXOPTS='$(SPHINXOPTS) -Ea -A daily=1' DISTVERSION=$(DISTVERSION)
316+
$(MAKE) dist-html SPHINXOPTS='$(SPHINXOPTS) --fresh-env --write-all --html-define daily=1' DISTVERSION=$(DISTVERSION)
317317

318318
# for stable releases: only build if not in pre-release stage (alpha, beta)
319319
# release candidate downloads are okay, since the stable tree can be in that stage

0 commit comments

Comments
 (0)