Skip to content

Commit 4664e4e

Browse files
authored
Merge branch 'main' into imaginary-class-109218
2 parents 7e68e91 + a9344cd commit 4664e4e

File tree

173 files changed

+5694
-3264
lines changed

Some content is hidden

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

173 files changed

+5694
-3264
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@ Doc/c-api/stable.rst @encukou
214214
**/*idlelib* @terryjreedy
215215
/Doc/library/idle.rst @terryjreedy
216216

217+
**/*annotationlib* @JelleZijlstra
217218
**/*typing* @JelleZijlstra @AlexWaygood
218219

219220
**/*ftplib @giampaolo

.github/workflows/build.yml

Lines changed: 28 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -249,27 +249,38 @@ jobs:
249249
arch: ${{ matrix.arch }}
250250

251251
build_macos:
252-
name: 'macOS'
253-
needs: check_source
254-
if: needs.check_source.outputs.run_tests == 'true'
255-
uses: ./.github/workflows/reusable-macos.yml
256-
with:
257-
config_hash: ${{ needs.check_source.outputs.config_hash }}
258-
# Cirrus and macos-14 are M1, macos-13 is default GHA Intel.
259-
# Cirrus used for upstream, macos-14 for forks.
260-
os-matrix: '["ghcr.io/cirruslabs/macos-runner:sonoma", "macos-14", "macos-13"]'
261-
262-
build_macos_free_threading:
263-
name: 'macOS (free-threading)'
252+
name: >-
253+
macOS
254+
${{ fromJSON(matrix.free-threading) && '(free-threading)' || '' }}
264255
needs: check_source
265256
if: needs.check_source.outputs.run_tests == 'true'
257+
strategy:
258+
fail-fast: false
259+
matrix:
260+
# Cirrus and macos-14 are M1, macos-13 is default GHA Intel.
261+
# macOS 13 only runs tests against the GIL-enabled CPython.
262+
# Cirrus used for upstream, macos-14 for forks.
263+
os:
264+
- ghcr.io/cirruslabs/macos-runner:sonoma
265+
- macos-14
266+
- macos-13
267+
is-fork: # only used for the exclusion trick
268+
- ${{ github.repository_owner != 'python' }}
269+
free-threading:
270+
- false
271+
- true
272+
exclude:
273+
- os: ghcr.io/cirruslabs/macos-runner:sonoma
274+
is-fork: true
275+
- os: macos-14
276+
is-fork: false
277+
- os: macos-13
278+
free-threading: true
266279
uses: ./.github/workflows/reusable-macos.yml
267280
with:
268281
config_hash: ${{ needs.check_source.outputs.config_hash }}
269-
free-threading: true
270-
# Cirrus and macos-14 are M1.
271-
# Cirrus used for upstream, macos-14 for forks.
272-
os-matrix: '["ghcr.io/cirruslabs/macos-runner:sonoma", "macos-14"]'
282+
free-threading: ${{ matrix.free-threading }}
283+
os: ${{ matrix.os }}
273284

274285
build_ubuntu:
275286
name: >-
@@ -337,7 +348,7 @@ jobs:
337348
with:
338349
save: false
339350
- name: Configure CPython
340-
run: ./configure --config-cache --enable-slower-safety --with-pydebug --with-openssl=$OPENSSL_DIR
351+
run: ./configure CFLAGS="-fdiagnostics-format=json" --config-cache --enable-slower-safety --with-pydebug --with-openssl=$OPENSSL_DIR
341352
- name: Build CPython
342353
run: make -j4
343354
- name: Display build info
@@ -596,7 +607,6 @@ jobs:
596607
- check-docs
597608
- check_generated_files
598609
- build_macos
599-
- build_macos_free_threading
600610
- build_ubuntu
601611
- build_ubuntu_ssltests
602612
- build_wasi
@@ -632,7 +642,6 @@ jobs:
632642
&& '
633643
check_generated_files,
634644
build_macos,
635-
build_macos_free_threading,
636645
build_ubuntu,
637646
build_ubuntu_ssltests,
638647
build_wasi,

.github/workflows/reusable-macos.yml

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,14 @@ on:
88
required: false
99
type: boolean
1010
default: false
11-
os-matrix:
12-
required: false
11+
os:
12+
description: OS to run the job
13+
required: true
1314
type: string
1415

1516
jobs:
1617
build_macos:
17-
name: build and test (${{ matrix.os }})
18+
name: build and test (${{ inputs.os }})
1819
timeout-minutes: 60
1920
env:
2021
HOMEBREW_NO_ANALYTICS: 1
@@ -23,18 +24,7 @@ jobs:
2324
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1
2425
PYTHONSTRICTEXTENSIONBUILD: 1
2526
TERM: linux
26-
strategy:
27-
fail-fast: false
28-
matrix:
29-
os: ${{fromJson(inputs.os-matrix)}}
30-
is-fork:
31-
- ${{ github.repository_owner != 'python' }}
32-
exclude:
33-
- os: "ghcr.io/cirruslabs/macos-runner:sonoma"
34-
is-fork: true
35-
- os: "macos-14"
36-
is-fork: false
37-
runs-on: ${{ matrix.os }}
27+
runs-on: ${{ inputs.os }}
3828
steps:
3929
- uses: actions/checkout@v4
4030
- name: Runner image version
@@ -43,7 +33,7 @@ jobs:
4333
uses: actions/cache@v4
4434
with:
4535
path: config.cache
46-
key: ${{ github.job }}-${{ matrix.os }}-${{ env.IMAGE_VERSION }}-${{ inputs.config_hash }}
36+
key: ${{ github.job }}-${{ inputs.os }}-${{ env.IMAGE_VERSION }}-${{ inputs.config_hash }}
4737
- name: Install Homebrew dependencies
4838
run: brew install pkg-config [email protected] xz gdbm tcl-tk
4939
- name: Configure CPython

.github/workflows/reusable-tsan.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ jobs:
3636
# Install clang-18
3737
wget https://apt.llvm.org/llvm.sh
3838
chmod +x llvm.sh
39-
sudo ./llvm.sh 18
40-
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-18 100
41-
sudo update-alternatives --set clang /usr/bin/clang-18
42-
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-18 100
43-
sudo update-alternatives --set clang++ /usr/bin/clang++-18
39+
sudo ./llvm.sh 17 # gh-121946: llvm-18 package is temporarily broken
40+
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-17 100
41+
sudo update-alternatives --set clang /usr/bin/clang-17
42+
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-17 100
43+
sudo update-alternatives --set clang++ /usr/bin/clang++-17
4444
# Reduce ASLR to avoid TSAN crashing
4545
sudo sysctl -w vm.mmap_rnd_bits=28
4646
- name: TSAN Option Setup

.github/workflows/reusable-ubuntu.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,17 +67,20 @@ jobs:
6767
working-directory: ${{ env.CPYTHON_BUILDDIR }}
6868
run: >-
6969
../cpython-ro-srcdir/configure
70+
CFLAGS="-fdiagnostics-format=json"
7071
--config-cache
7172
--with-pydebug
7273
--enable-slower-safety
7374
--with-openssl=$OPENSSL_DIR
7475
${{ fromJSON(inputs.free-threading) && '--disable-gil' || '' }}
7576
- name: Build CPython out-of-tree
7677
working-directory: ${{ env.CPYTHON_BUILDDIR }}
77-
run: make -j4
78+
run: set -o pipefail; make -j4 2>&1 | tee compiler_output.txt
7879
- name: Display build info
7980
working-directory: ${{ env.CPYTHON_BUILDDIR }}
8081
run: make pythoninfo
82+
- name: Check compiler warnings
83+
run: python Tools/build/check_warnings.py --compiler-output-file-path=${{ env.CPYTHON_BUILDDIR }}/compiler_output.txt --warning-ignore-file-path ${GITHUB_WORKSPACE}/Tools/build/.warningignore_ubuntu
8184
- name: Remount sources writable for tests
8285
# some tests write to srcdir, lack of pyc files slows down testing
8386
run: sudo mount $CPYTHON_RO_SRCDIR -oremount,rw

Android/android.py

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/usr/bin/env python3
22

33
import argparse
4+
from glob import glob
45
import os
56
import re
67
import shutil
@@ -16,16 +17,21 @@
1617
CROSS_BUILD_DIR = CHECKOUT / "cross-build"
1718

1819

19-
def delete_if_exists(path):
20-
if path.exists():
20+
def delete_glob(pattern):
21+
# Path.glob doesn't accept non-relative patterns.
22+
for path in glob(str(pattern)):
23+
path = Path(path)
2124
print(f"Deleting {path} ...")
22-
shutil.rmtree(path)
25+
if path.is_dir() and not path.is_symlink():
26+
shutil.rmtree(path)
27+
else:
28+
path.unlink()
2329

2430

2531
def subdir(name, *, clean=None):
2632
path = CROSS_BUILD_DIR / name
2733
if clean:
28-
delete_if_exists(path)
34+
delete_glob(path)
2935
if not path.exists():
3036
if clean is None:
3137
sys.exit(
@@ -150,10 +156,17 @@ def configure_host_python(context):
150156

151157

152158
def make_host_python(context):
159+
# The CFLAGS and LDFLAGS set in android-env include the prefix dir, so
160+
# delete any previously-installed Python libs and include files to prevent
161+
# them being used during the build.
153162
host_dir = subdir(context.host)
163+
prefix_dir = host_dir / "prefix"
164+
delete_glob(f"{prefix_dir}/include/python*")
165+
delete_glob(f"{prefix_dir}/lib/libpython*")
166+
154167
os.chdir(host_dir / "build")
155168
run(["make", "-j", str(os.cpu_count())], host=context.host)
156-
run(["make", "install", f"prefix={host_dir}/prefix"], host=context.host)
169+
run(["make", "install", f"prefix={prefix_dir}"], host=context.host)
157170

158171

159172
def build_all(context):
@@ -164,7 +177,7 @@ def build_all(context):
164177

165178

166179
def clean_all(context):
167-
delete_if_exists(CROSS_BUILD_DIR)
180+
delete_glob(CROSS_BUILD_DIR)
168181

169182

170183
# To avoid distributing compiled artifacts without corresponding source code,

Android/testbed/app/build.gradle.kts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,17 @@ plugins {
77

88
val PYTHON_DIR = File(projectDir, "../../..").canonicalPath
99
val PYTHON_CROSS_DIR = "$PYTHON_DIR/cross-build"
10+
1011
val ABIS = mapOf(
1112
"arm64-v8a" to "aarch64-linux-android",
1213
"x86_64" to "x86_64-linux-android",
13-
)
14+
).filter { File("$PYTHON_CROSS_DIR/${it.value}").exists() }
15+
if (ABIS.isEmpty()) {
16+
throw GradleException(
17+
"No Android ABIs found in $PYTHON_CROSS_DIR: see Android/README.md " +
18+
"for building instructions."
19+
)
20+
}
1421

1522
val PYTHON_VERSION = File("$PYTHON_DIR/Include/patchlevel.h").useLines {
1623
for (line in it) {

Doc/bugs.rst

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,16 @@ Documentation bugs
1616
==================
1717

1818
If you find a bug in this documentation or would like to propose an improvement,
19-
please submit a bug report on the :ref:`tracker <using-the-tracker>`. If you
19+
please submit a bug report on the :ref:`issue tracker <using-the-tracker>`. If you
2020
have a suggestion on how to fix it, include that as well.
2121

2222
You can also open a discussion item on our
2323
`Documentation Discourse forum <https://discuss.python.org/c/documentation/26>`_.
2424

2525
If you find a bug in the theme (HTML / CSS / JavaScript) of the
26-
documentation, please submit a bug report on the `python-doc-theme bug
26+
documentation, please submit a bug report on the `python-doc-theme issue
2727
tracker <https://github.com/python/python-docs-theme>`_.
2828

29-
If you're short on time, you can also email documentation bug reports to
30-
[email protected] (behavioral bugs can be sent to [email protected]).
31-
'docs@' is a mailing list run by volunteers; your request will be noticed,
32-
though it may take a while to be processed.
33-
3429
.. seealso::
3530

3631
`Documentation bugs`_

Doc/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
# ---------------------
2121

2222
extensions = [
23+
'audit_events',
2324
'c_annotations',
2425
'glossary_search',
2526
'lexers',

Doc/contents.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
installing/index.rst
1515
howto/index.rst
1616
faq/index.rst
17+
deprecations/index.rst
1718
glossary.rst
1819

1920
about.rst

0 commit comments

Comments
 (0)