Skip to content

Commit 8f84998

Browse files
authored
Merge branch '3.13' into pythongh-124872-docs
2 parents 2f5e9bb + 5f42184 commit 8f84998

File tree

278 files changed

+9339
-6455
lines changed

Some content is hidden

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

278 files changed

+9339
-6455
lines changed

.devcontainer/Dockerfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ FROM docker.io/library/fedora:40
22

33
ENV CC=clang
44

5-
ENV WASI_SDK_VERSION=22
5+
ENV WASI_SDK_VERSION=24
66
ENV WASI_SDK_PATH=/opt/wasi-sdk
77

88
ENV WASMTIME_HOME=/opt/wasmtime
@@ -14,7 +14,7 @@ RUN dnf -y --nodocs --setopt=install_weak_deps=False install /usr/bin/{blurb,cla
1414
dnf -y clean all
1515

1616
RUN mkdir ${WASI_SDK_PATH} && \
17-
curl --location https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${WASI_SDK_VERSION}/wasi-sdk-${WASI_SDK_VERSION}.0-linux.tar.gz | \
17+
curl --location https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${WASI_SDK_VERSION}/wasi-sdk-${WASI_SDK_VERSION}.0-x86_64-linux.tar.gz | \
1818
tar --strip-components 1 --directory ${WASI_SDK_PATH} --extract --gunzip
1919

2020
RUN mkdir --parents ${WASMTIME_HOME} && \

.github/workflows/build.yml

+47-10
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242

4343
check_abi:
4444
name: 'Check if the ABI has changed'
45-
runs-on: ubuntu-latest
45+
runs-on: ubuntu-22.04
4646
needs: check_source
4747
if: needs.check_source.outputs.run_tests == 'true'
4848
steps:
@@ -83,6 +83,50 @@ jobs:
8383
name: abi-data
8484
path: ./Doc/data/*.abi
8585

86+
check_autoconf_regen:
87+
name: 'Check if Autoconf files are up to date'
88+
# Don't use ubuntu-latest but a specific version to make the job
89+
# reproducible: to get the same tools versions (autoconf, aclocal, ...)
90+
runs-on: ubuntu-24.04
91+
container:
92+
image: ghcr.io/python/autoconf:2024.10.11.11293396815
93+
timeout-minutes: 60
94+
needs: check_source
95+
if: needs.check_source.outputs.run_tests == 'true'
96+
steps:
97+
- name: Install Git
98+
run: |
99+
apt install git -yq
100+
git config --global --add safe.directory "$GITHUB_WORKSPACE"
101+
- uses: actions/checkout@v4
102+
with:
103+
fetch-depth: 1
104+
- name: Runner image version
105+
run: echo "IMAGE_VERSION=${ImageVersion}" >> $GITHUB_ENV
106+
- name: Check Autoconf and aclocal versions
107+
run: |
108+
grep "Generated by GNU Autoconf 2.71" configure
109+
grep "aclocal 1.16.5" aclocal.m4
110+
grep -q "runstatedir" configure
111+
grep -q "PKG_PROG_PKG_CONFIG" aclocal.m4
112+
- name: Regenerate autoconf files
113+
# Same command used by Tools/build/regen-configure.sh ($AUTORECONF)
114+
run: autoreconf -ivf -Werror
115+
- name: Check for changes
116+
run: |
117+
git add -u
118+
changes=$(git status --porcelain)
119+
# Check for changes in regenerated files
120+
if test -n "$changes"; then
121+
echo "Generated files not up to date."
122+
echo "Perhaps you forgot to run make regen-all or build.bat --regen. ;)"
123+
echo "configure files must be regenerated with a specific version of autoconf."
124+
echo "$changes"
125+
echo ""
126+
git diff --staged || true
127+
exit 1
128+
fi
129+
86130
check_generated_files:
87131
name: 'Check if generated files are up to date'
88132
# Don't use ubuntu-latest but a specific version to make the job
@@ -112,19 +156,10 @@ jobs:
112156
uses: hendrikmuhs/[email protected]
113157
with:
114158
save: false
115-
- name: Check Autoconf and aclocal versions
116-
run: |
117-
grep "Generated by GNU Autoconf 2.71" configure
118-
grep "aclocal 1.16.5" aclocal.m4
119-
grep -q "runstatedir" configure
120-
grep -q "PKG_PROG_PKG_CONFIG" aclocal.m4
121159
- name: Configure CPython
122160
run: |
123161
# Build Python with the libpython dynamic library
124162
./configure --config-cache --with-pydebug --enable-shared
125-
- name: Regenerate autoconf files
126-
# Same command used by Tools/build/regen-configure.sh ($AUTORECONF)
127-
run: autoreconf -ivf -Werror
128163
- name: Build CPython
129164
run: |
130165
make -j4 regen-all
@@ -543,6 +578,7 @@ jobs:
543578
needs:
544579
- check_source # Transitive dependency, needed to access `run_tests` value
545580
- check-docs
581+
- check_autoconf_regen
546582
- check_generated_files
547583
- build_macos
548584
- build_ubuntu
@@ -578,6 +614,7 @@ jobs:
578614
${{
579615
needs.check_source.outputs.run_tests != 'true'
580616
&& '
617+
check_autoconf_regen,
581618
check_generated_files,
582619
build_macos,
583620
build_ubuntu,

.github/workflows/mypy.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353
- uses: actions/checkout@v4
5454
- uses: actions/setup-python@v5
5555
with:
56-
python-version: "3.11"
56+
python-version: "3.13"
5757
cache: pip
5858
cache-dependency-path: Tools/requirements-dev.txt
5959
- run: pip install -r Tools/requirements-dev.txt

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

-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
#!/bin/sh
22
apt-get update
33

4-
# autoconf-archive is needed by autoreconf (check_generated_files job)
54
apt-get -yq install \
65
build-essential \
76
pkg-config \
8-
autoconf-archive \
97
ccache \
108
gdb \
119
lcov \

.github/workflows/reusable-change-detection.yml

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
---
2-
3-
name: Change detection
1+
name: Reusable change detection
42

53
on: # yamllint disable-line rule:truthy
64
workflow_call:

.github/workflows/reusable-docs.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Docs
1+
name: Reusable Docs
22

33
on:
44
workflow_call:
@@ -84,7 +84,7 @@ jobs:
8484
- name: 'Set up Python'
8585
uses: actions/setup-python@v5
8686
with:
87-
python-version: '3.12' # known to work with Sphinx 6.2.1
87+
python-version: '3.13' # known to work with Sphinx 7.2.6
8888
cache: 'pip'
8989
cache-dependency-path: 'Doc/requirements-oldest-sphinx.txt'
9090
- name: 'Install build dependencies'
@@ -95,7 +95,7 @@ jobs:
9595
# Run "doctest" on HEAD as new syntax doesn't exist in the latest stable release
9696
doctest:
9797
name: 'Doctest'
98-
runs-on: ubuntu-latest
98+
runs-on: ubuntu-22.04
9999
timeout-minutes: 60
100100
steps:
101101
- uses: actions/checkout@v4

.github/workflows/reusable-macos.yml

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
name: Reusable macOS
2+
13
on:
24
workflow_call:
35
inputs:

.github/workflows/reusable-tsan.yml

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
name: Reusable Thread Sanitizer
2+
13
on:
24
workflow_call:
35
inputs:

.github/workflows/reusable-ubuntu.yml

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
name: Reusable Ubuntu
2+
13
on:
24
workflow_call:
35
inputs:

.github/workflows/reusable-wasi.yml

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
name: Reusable WASI
2+
13
on:
24
workflow_call:
35
inputs:
@@ -12,7 +14,7 @@ jobs:
1214
runs-on: ubuntu-22.04
1315
env:
1416
WASMTIME_VERSION: 22.0.0
15-
WASI_SDK_VERSION: 22
17+
WASI_SDK_VERSION: 24
1618
WASI_SDK_PATH: /opt/wasi-sdk
1719
CROSS_BUILD_PYTHON: cross-build/build
1820
CROSS_BUILD_WASI: cross-build/wasm32-wasi
@@ -33,7 +35,7 @@ jobs:
3335
if: steps.cache-wasi-sdk.outputs.cache-hit != 'true'
3436
run: |
3537
mkdir ${{ env.WASI_SDK_PATH }} && \
36-
curl -s -S --location https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${{ env.WASI_SDK_VERSION }}/wasi-sdk-${{ env.WASI_SDK_VERSION }}.0-linux.tar.gz | \
38+
curl -s -S --location https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${{ env.WASI_SDK_VERSION }}/wasi-sdk-${{ env.WASI_SDK_VERSION }}.0-x86_64-linux.tar.gz | \
3739
tar --strip-components 1 --directory ${{ env.WASI_SDK_PATH }} --extract --gunzip
3840
- name: "Configure ccache action"
3941
uses: hendrikmuhs/[email protected]

.github/workflows/reusable-windows-msi.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: TestsMSI
1+
name: Reusable Windows MSI
22

33
on:
44
workflow_call:

.github/workflows/reusable-windows.yml

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
name: Reusable Windows
2+
13
on:
24
workflow_call:
35
inputs:

Android/android-env.sh

+7-3
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ fail() {
2424
# * https://android.googlesource.com/platform/ndk/+/ndk-rXX-release/docs/BuildSystemMaintainers.md
2525
# where XX is the NDK version. Do a diff against the version you're upgrading from, e.g.:
2626
# https://android.googlesource.com/platform/ndk/+/ndk-r25-release..ndk-r26-release/docs/BuildSystemMaintainers.md
27-
ndk_version=26.2.11394342
27+
ndk_version=27.1.12297006
2828

2929
ndk=$ANDROID_HOME/ndk/$ndk_version
3030
if ! [ -e $ndk ]; then
@@ -58,8 +58,8 @@ for path in "$AR" "$AS" "$CC" "$CXX" "$LD" "$NM" "$RANLIB" "$READELF" "$STRIP";
5858
fi
5959
done
6060

61-
export CFLAGS=""
62-
export LDFLAGS="-Wl,--build-id=sha1 -Wl,--no-rosegment"
61+
export CFLAGS="-D__BIONIC_NO_PAGE_SIZE_MACRO"
62+
export LDFLAGS="-Wl,--build-id=sha1 -Wl,--no-rosegment -Wl,-z,max-page-size=16384"
6363

6464
# Unlike Linux, Android does not implicitly use a dlopened library to resolve
6565
# relocations in subsequently-loaded libraries, even if RTLD_GLOBAL is used
@@ -85,6 +85,10 @@ if [ -n "${PREFIX:-}" ]; then
8585
export PKG_CONFIG_LIBDIR="$abs_prefix/lib/pkgconfig"
8686
fi
8787

88+
# When compiling C++, some build systems will combine CFLAGS and CXXFLAGS, and some will
89+
# use CXXFLAGS alone.
90+
export CXXFLAGS=$CFLAGS
91+
8892
# Use the same variable name as conda-build
8993
if [ $(uname) = "Darwin" ]; then
9094
export CPU_COUNT=$(sysctl -n hw.ncpu)

Android/android.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,8 @@ def make_build_python(context):
138138

139139
def unpack_deps(host):
140140
deps_url = "https://github.com/beeware/cpython-android-source-deps/releases/download"
141-
for name_ver in ["bzip2-1.0.8-1", "libffi-3.4.4-2", "openssl-3.0.15-0",
142-
"sqlite-3.45.1-0", "xz-5.4.6-0"]:
141+
for name_ver in ["bzip2-1.0.8-2", "libffi-3.4.4-3", "openssl-3.0.15-4",
142+
"sqlite-3.45.3-3", "xz-5.4.6-1"]:
143143
filename = f"{name_ver}-{host}.tar.gz"
144144
download(f"{deps_url}/{name_ver}/{filename}")
145145
run(["tar", "-xf", filename])
@@ -189,12 +189,13 @@ def configure_host_python(context):
189189

190190
def make_host_python(context):
191191
# The CFLAGS and LDFLAGS set in android-env include the prefix dir, so
192-
# delete any previously-installed Python libs and include files to prevent
193-
# them being used during the build.
192+
# delete any previous Python installation to prevent it being used during
193+
# the build.
194194
host_dir = subdir(context.host)
195195
prefix_dir = host_dir / "prefix"
196196
delete_glob(f"{prefix_dir}/include/python*")
197197
delete_glob(f"{prefix_dir}/lib/libpython*")
198+
delete_glob(f"{prefix_dir}/lib/python*")
198199

199200
os.chdir(host_dir / "build")
200201
run(["make", "-j", str(os.cpu_count())], host=context.host)

Android/testbed/app/build.gradle.kts

+12-11
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,6 @@ val PYTHON_VERSION = file("$PYTHON_DIR/Include/patchlevel.h").useLines {
3030
throw GradleException("Failed to find Python version")
3131
}
3232

33-
android.ndkVersion = file("../../android-env.sh").useLines {
34-
for (line in it) {
35-
val match = """ndk_version=(\S+)""".toRegex().find(line)
36-
if (match != null) {
37-
return@useLines match.groupValues[1]
38-
}
39-
}
40-
throw GradleException("Failed to find NDK version")
41-
}
42-
4333

4434
android {
4535
namespace = "org.python.testbed"
@@ -55,11 +45,22 @@ android {
5545
ndk.abiFilters.addAll(ABIS.keys)
5646
externalNativeBuild.cmake.arguments(
5747
"-DPYTHON_CROSS_DIR=$PYTHON_CROSS_DIR",
58-
"-DPYTHON_VERSION=$PYTHON_VERSION")
48+
"-DPYTHON_VERSION=$PYTHON_VERSION",
49+
"-DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON",
50+
)
5951

6052
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
6153
}
6254

55+
val androidEnvFile = file("../../android-env.sh").absoluteFile
56+
ndkVersion = androidEnvFile.useLines {
57+
for (line in it) {
58+
"""ndk_version=(\S+)""".toRegex().find(line)?.let {
59+
return@useLines it.groupValues[1]
60+
}
61+
}
62+
throw GradleException("Failed to find NDK version in $androidEnvFile")
63+
}
6364
externalNativeBuild.cmake {
6465
path("src/main/c/CMakeLists.txt")
6566
}

Android/testbed/build.gradle.kts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Top-level build file where you can add configuration options common to all sub-projects/modules.
22
plugins {
3-
id("com.android.application") version "8.4.2" apply false
3+
id("com.android.application") version "8.6.1" apply false
44
id("org.jetbrains.kotlin.android") version "1.9.22" apply false
55
}
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#Mon Feb 19 20:29:06 GMT 2024
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
4-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
4+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
55
zipStoreBase=GRADLE_USER_HOME
66
zipStorePath=wrapper/dists

Doc/README.rst

+2-5
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,5 @@ Bugs in the content should be reported to the
133133

134134
Bugs in the toolset should be reported to the tools themselves.
135135

136-
You can also send a mail to the Python Documentation Team at [email protected],
137-
and we will process your request as soon as possible.
138-
139-
If you want to help the Documentation Team, you are always welcome. Just send
140-
136+
To help with the documentation, or report any problems, please leave a message
137+
on `discuss.python.org <https://discuss.python.org/c/documentation>`_.

Doc/c-api/init.rst

+8-5
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,7 @@ Process-wide parameters
615615
returned string points into static storage; the caller should not modify its
616616
value. This corresponds to the :makevar:`prefix` variable in the top-level
617617
:file:`Makefile` and the :option:`--prefix` argument to the :program:`configure`
618-
script at build time. The value is available to Python code as ``sys.prefix``.
618+
script at build time. The value is available to Python code as ``sys.base_prefix``.
619619
It is only useful on Unix. See also the next function.
620620
621621
This function should not be called before :c:func:`Py_Initialize`, otherwise
@@ -625,7 +625,8 @@ Process-wide parameters
625625
It now returns ``NULL`` if called before :c:func:`Py_Initialize`.
626626
627627
.. deprecated-removed:: 3.13 3.15
628-
Get :data:`sys.prefix` instead.
628+
Get :data:`sys.base_prefix` instead, or :data:`sys.prefix` if
629+
:ref:`virtual environments <venv-def>` need to be handled.
629630
630631
631632
.. c:function:: wchar_t* Py_GetExecPrefix()
@@ -638,7 +639,8 @@ Process-wide parameters
638639
should not modify its value. This corresponds to the :makevar:`exec_prefix`
639640
variable in the top-level :file:`Makefile` and the ``--exec-prefix``
640641
argument to the :program:`configure` script at build time. The value is
641-
available to Python code as ``sys.exec_prefix``. It is only useful on Unix.
642+
available to Python code as ``sys.base_exec_prefix``. It is only useful on
643+
Unix.
642644
643645
Background: The exec-prefix differs from the prefix when platform dependent
644646
files (such as executables and shared libraries) are installed in a different
@@ -669,7 +671,8 @@ Process-wide parameters
669671
It now returns ``NULL`` if called before :c:func:`Py_Initialize`.
670672
671673
.. deprecated-removed:: 3.13 3.15
672-
Get :data:`sys.exec_prefix` instead.
674+
Get :data:`sys.base_exec_prefix` instead, or :data:`sys.exec_prefix` if
675+
:ref:`virtual environments <venv-def>` need to be handled.
673676
674677
675678
.. c:function:: wchar_t* Py_GetProgramFullPath()
@@ -2368,7 +2371,7 @@ Example usage::
23682371
23692372
In the above example, :c:macro:`Py_SETREF` calls :c:macro:`Py_DECREF`, which
23702373
can call arbitrary code through an object's deallocation function. The critical
2371-
section API avoids potentital deadlocks due to reentrancy and lock ordering
2374+
section API avoids potential deadlocks due to reentrancy and lock ordering
23722375
by allowing the runtime to temporarily suspend the critical section if the
23732376
code triggered by the finalizer blocks and calls :c:func:`PyEval_SaveThread`.
23742377

0 commit comments

Comments
 (0)