Skip to content

Commit 2246cfa

Browse files
authored
Merge branch '3.12' into backport-61b9811-3.12
2 parents e92aed1 + 032058c commit 2246cfa

File tree

110 files changed

+1916
-549
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

+1916
-549
lines changed

.github/workflows/build.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ jobs:
142142
name: 'Check if generated files are up to date'
143143
# Don't use ubuntu-latest but a specific version to make the job
144144
# reproducible: to get the same tools versions (autoconf, aclocal, ...)
145-
runs-on: ubuntu-22.04
145+
runs-on: ubuntu-24.04
146146
timeout-minutes: 60
147147
needs: check_source
148148
if: needs.check_source.outputs.run_tests == 'true'
@@ -295,7 +295,7 @@ jobs:
295295
strategy:
296296
fail-fast: false
297297
matrix:
298-
os: [ubuntu-22.04]
298+
os: [ubuntu-24.04]
299299
openssl_ver: [3.0.15, 3.1.7, 3.2.3, 3.3.2]
300300
env:
301301
OPENSSL_VER: ${{ matrix.openssl_ver }}
@@ -349,7 +349,7 @@ jobs:
349349

350350
test_hypothesis:
351351
name: "Hypothesis tests on Ubuntu"
352-
runs-on: ubuntu-22.04
352+
runs-on: ubuntu-24.04
353353
timeout-minutes: 60
354354
needs: check_source
355355
if: needs.check_source.outputs.run_tests == 'true' && needs.check_source.outputs.run_hypothesis == 'true'
@@ -468,6 +468,9 @@ jobs:
468468
timeout-minutes: 60
469469
needs: check_source
470470
if: needs.check_source.outputs.run_tests == 'true'
471+
strategy:
472+
matrix:
473+
os: [ubuntu-24.04]
471474
env:
472475
OPENSSL_VER: 3.0.15
473476
PYTHONSTRICTEXTENSIONBUILD: 1

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ apt-get -yq install \
1616
libgdbm-compat-dev \
1717
liblzma-dev \
1818
libncurses5-dev \
19+
libnsl-dev \
1920
libreadline6-dev \
2021
libsqlite3-dev \
2122
libssl-dev \

.github/workflows/reusable-docs.yml

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ jobs:
6262
continue-on-error: true
6363
run: |
6464
set -Eeuo pipefail
65-
# Build docs with the '-n' (nit-picky) option; write warnings to file
66-
make -C Doc/ PYTHON=../python SPHINXOPTS="-q -n -W --keep-going -w sphinx-warnings.txt" html
65+
# Build docs with the nit-picky option; write warnings to file
66+
make -C Doc/ PYTHON=../python SPHINXOPTS="--quiet --nitpicky --fail-on-warning --keep-going --warning-file sphinx-warnings.txt" html
6767
- name: 'Check warnings'
6868
if: github.event_name == 'pull_request'
6969
run: |
@@ -73,26 +73,6 @@ jobs:
7373
--fail-if-improved \
7474
--fail-if-new-news-nit
7575
76-
# This build doesn't use problem matchers or check annotations
77-
build_doc_oldest_supported_sphinx:
78-
name: 'Docs (Oldest Sphinx)'
79-
runs-on: ubuntu-latest
80-
timeout-minutes: 60
81-
steps:
82-
- uses: actions/checkout@v4
83-
with:
84-
persist-credentials: false
85-
- name: 'Set up Python'
86-
uses: actions/setup-python@v5
87-
with:
88-
python-version: '3.13' # known to work with Sphinx 7.2.6
89-
cache: 'pip'
90-
cache-dependency-path: 'Doc/requirements-oldest-sphinx.txt'
91-
- name: 'Install build dependencies'
92-
run: make -C Doc/ venv REQUIREMENTS="requirements-oldest-sphinx.txt"
93-
- name: 'Build HTML documentation'
94-
run: make -C Doc/ SPHINXOPTS="-q" SPHINXERRORHANDLING="-W --keep-going" html
95-
9676
# Run "doctest" on HEAD as new syntax doesn't exist in the latest stable release
9777
doctest:
9878
name: 'Doctest'
@@ -118,4 +98,4 @@ jobs:
11898
run: make -C Doc/ PYTHON=../python venv
11999
# Use "xvfb-run" since some doctest tests open GUI windows
120100
- name: 'Run documentation doctest'
121-
run: xvfb-run make -C Doc/ PYTHON=../python SPHINXERRORHANDLING="-W --keep-going" doctest
101+
run: xvfb-run make -C Doc/ PYTHON=../python SPHINXERRORHANDLING="--fail-on-warning --keep-going" doctest

.github/workflows/reusable-tsan.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ on:
1313
jobs:
1414
build_tsan_reusable:
1515
name: 'Thread sanitizer'
16-
runs-on: ubuntu-22.04
16+
runs-on: ubuntu-24.04
1717
timeout-minutes: 60
1818
env:
1919
OPTIONS: ${{ inputs.options }}

.github/workflows/reusable-ubuntu.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
strategy:
2121
fail-fast: false
2222
matrix:
23-
os: [ubuntu-22.04]
23+
os: [ubuntu-24.04]
2424
env:
2525
OPENSSL_VER: 3.0.15
2626
PYTHONSTRICTEXTENSIONBUILD: 1

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
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/
@@ -34,7 +34,7 @@ repos:
3434
types_or: [c, inc, python, rst]
3535

3636
- repo: https://github.com/woodruffw/zizmor-pre-commit
37-
rev: v0.8.0
37+
rev: v1.1.1
3838
hooks:
3939
- id: zizmor
4040

Doc/Makefile

Lines changed: 11 additions & 11 deletions
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
@@ -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

Doc/conf.py

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@
99
import importlib
1010
import os
1111
import sys
12-
import time
13-
14-
import sphinx
1512

1613
# Make our custom extensions available to Sphinx
1714
sys.path.append(os.path.abspath('tools/extensions'))
@@ -61,10 +58,7 @@
6158

6259
# General substitutions.
6360
project = 'Python'
64-
if sphinx.version_info[:2] >= (8, 1):
65-
copyright = "2001-%Y, Python Software Foundation"
66-
else:
67-
copyright = f"2001-{time.strftime('%Y')}, Python Software Foundation"
61+
copyright = "2001-%Y, Python Software Foundation"
6862

6963
# We look for the Include/patchlevel.h file in the current Python source tree
7064
# and replace the values accordingly.
@@ -85,7 +79,8 @@
8579
highlight_language = 'python3'
8680

8781
# Minimum version of sphinx required
88-
needs_sphinx = '7.2.6'
82+
# Keep this version in sync with ``Doc/requirements.txt``.
83+
needs_sphinx = '8.1.3'
8984

9085
# Create table of contents entries for domain objects (e.g. functions, classes,
9186
# attributes, etc.). Default is True.
@@ -350,13 +345,7 @@
350345

351346
# This 'Last updated on:' timestamp is inserted at the bottom of every page.
352347
html_last_updated_fmt = '%b %d, %Y (%H:%M UTC)'
353-
if sphinx.version_info[:2] >= (8, 1):
354-
html_last_updated_use_utc = True
355-
else:
356-
html_time = int(os.environ.get('SOURCE_DATE_EPOCH', time.time()))
357-
html_last_updated_fmt = time.strftime(
358-
html_last_updated_fmt, time.gmtime(html_time)
359-
)
348+
html_last_updated_use_utc = True
360349

361350
# Path to find HTML templates to override theme
362351
templates_path = ['tools/templates']
@@ -594,16 +583,6 @@
594583
}
595584
extlinks_detect_hardcoded_links = True
596585

597-
if sphinx.version_info[:2] < (8, 1):
598-
# Sphinx 8.1 has in-built CVE and CWE roles.
599-
extlinks |= {
600-
"cve": (
601-
"https://www.cve.org/CVERecord?id=CVE-%s",
602-
"CVE-%s",
603-
),
604-
"cwe": ("https://cwe.mitre.org/data/definitions/%s.html", "CWE-%s"),
605-
}
606-
607586
# Options for c_annotations extension
608587
# -----------------------------------
609588

Doc/constraints.txt

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,12 @@ packaging<25
1313
Pygments<3
1414
requests<3
1515
snowballstemmer<3
16-
# keep lower-bounds until Sphinx 8.1 is released
17-
# https://github.com/sphinx-doc/sphinx/pull/12756
18-
sphinxcontrib-applehelp>=1.0.7,<3
19-
sphinxcontrib-devhelp>=1.0.6,<3
20-
sphinxcontrib-htmlhelp>=2.0.6,<3
21-
sphinxcontrib-jsmath>=1.0.1,<2
22-
sphinxcontrib-qthelp>=1.0.6,<3
23-
sphinxcontrib-serializinghtml>=1.1.9,<3
16+
sphinxcontrib-applehelp<3
17+
sphinxcontrib-devhelp<3
18+
sphinxcontrib-htmlhelp<3
19+
sphinxcontrib-jsmath<2
20+
sphinxcontrib-qthelp<3
21+
sphinxcontrib-serializinghtml<3
2422

2523
# Direct dependencies of Jinja2 (Jinja is a dependency of Sphinx, see above)
2624
MarkupSafe<3

Doc/faq/programming.rst

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1906,28 +1906,30 @@ In the standard library code, you will see several common patterns for
19061906
correctly using identity tests:
19071907

19081908
1) As recommended by :pep:`8`, an identity test is the preferred way to check
1909-
for ``None``. This reads like plain English in code and avoids confusion with
1910-
other objects that may have boolean values that evaluate to false.
1909+
for ``None``. This reads like plain English in code and avoids confusion
1910+
with other objects that may have boolean values that evaluate to false.
19111911

19121912
2) Detecting optional arguments can be tricky when ``None`` is a valid input
1913-
value. In those situations, you can create a singleton sentinel object
1914-
guaranteed to be distinct from other objects. For example, here is how
1915-
to implement a method that behaves like :meth:`dict.pop`::
1913+
value. In those situations, you can create a singleton sentinel object
1914+
guaranteed to be distinct from other objects. For example, here is how
1915+
to implement a method that behaves like :meth:`dict.pop`:
19161916

1917-
_sentinel = object()
1917+
.. code-block:: python
19181918
1919-
def pop(self, key, default=_sentinel):
1920-
if key in self:
1921-
value = self[key]
1922-
del self[key]
1923-
return value
1924-
if default is _sentinel:
1925-
raise KeyError(key)
1926-
return default
1919+
_sentinel = object()
1920+
1921+
def pop(self, key, default=_sentinel):
1922+
if key in self:
1923+
value = self[key]
1924+
del self[key]
1925+
return value
1926+
if default is _sentinel:
1927+
raise KeyError(key)
1928+
return default
19271929
19281930
3) Container implementations sometimes need to augment equality tests with
1929-
identity tests. This prevents the code from being confused by objects such as
1930-
``float('NaN')`` that are not equal to themselves.
1931+
identity tests. This prevents the code from being confused by objects
1932+
such as ``float('NaN')`` that are not equal to themselves.
19311933

19321934
For example, here is the implementation of
19331935
:meth:`!collections.abc.Sequence.__contains__`::

0 commit comments

Comments
 (0)