Skip to content

Commit 6e8a4de

Browse files
committed
Merge in the main branch
2 parents 7375c09 + 36c6178 commit 6e8a4de

File tree

310 files changed

+6874
-2803
lines changed

Some content is hidden

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

310 files changed

+6874
-2803
lines changed

.github/workflows/build.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ jobs:
120120
- name: Build CPython
121121
run: |
122122
make -j4 regen-all
123-
make regen-stdlib-module-names regen-sbom
123+
make regen-stdlib-module-names regen-sbom regen-unicodedata
124124
- name: Check for changes
125125
run: |
126126
git add -u
@@ -235,10 +235,19 @@ jobs:
235235
free-threading:
236236
- false
237237
- true
238+
os:
239+
- ubuntu-24.04
240+
- ubuntu-24.04-aarch64
241+
is-fork: # only used for the exclusion trick
242+
- ${{ github.repository_owner != 'python' }}
243+
exclude:
244+
- os: ubuntu-24.04-aarch64
245+
is-fork: true
238246
uses: ./.github/workflows/reusable-ubuntu.yml
239247
with:
240248
config_hash: ${{ needs.check_source.outputs.config_hash }}
241249
free-threading: ${{ matrix.free-threading }}
250+
os: ${{ matrix.os }}
242251

243252
build_ubuntu_ssltests:
244253
name: 'Ubuntu SSL tests with OpenSSL'
@@ -250,7 +259,8 @@ jobs:
250259
fail-fast: false
251260
matrix:
252261
os: [ubuntu-24.04]
253-
openssl_ver: [3.0.15, 3.1.7, 3.2.3, 3.3.2]
262+
openssl_ver: [3.0.15, 3.1.7, 3.2.3, 3.3.2, 3.4.0]
263+
# See Tools/ssl/make_ssl_data.py for notes on adding a new version
254264
env:
255265
OPENSSL_VER: ${{ matrix.openssl_ver }}
256266
MULTISSL_DIR: ${{ github.workspace }}/multissl

.github/workflows/jit.yml

Lines changed: 12 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ concurrency:
2828
jobs:
2929
interpreter:
3030
name: Interpreter (Debug)
31-
runs-on: ubuntu-22.04
31+
runs-on: ubuntu-24.04
3232
timeout-minutes: 90
3333
steps:
3434
- uses: actions/checkout@v4
@@ -54,9 +54,7 @@ jobs:
5454
- x86_64-apple-darwin/clang
5555
- aarch64-apple-darwin/clang
5656
- x86_64-unknown-linux-gnu/gcc
57-
- x86_64-unknown-linux-gnu/clang
5857
- aarch64-unknown-linux-gnu/gcc
59-
- aarch64-unknown-linux-gnu/clang
6058
debug:
6159
- true
6260
- false
@@ -66,41 +64,25 @@ jobs:
6664
- target: i686-pc-windows-msvc/msvc
6765
architecture: Win32
6866
runner: windows-latest
69-
compiler: msvc
7067
- target: x86_64-pc-windows-msvc/msvc
7168
architecture: x64
7269
runner: windows-latest
73-
compiler: msvc
7470
- target: aarch64-pc-windows-msvc/msvc
7571
architecture: ARM64
7672
runner: windows-latest
77-
compiler: msvc
7873
- target: x86_64-apple-darwin/clang
7974
architecture: x86_64
8075
runner: macos-13
81-
compiler: clang
8276
- target: aarch64-apple-darwin/clang
8377
architecture: aarch64
8478
runner: macos-14
85-
compiler: clang
8679
- target: x86_64-unknown-linux-gnu/gcc
8780
architecture: x86_64
88-
runner: ubuntu-22.04
89-
compiler: gcc
90-
- target: x86_64-unknown-linux-gnu/clang
91-
architecture: x86_64
92-
runner: ubuntu-22.04
93-
compiler: clang
81+
runner: ubuntu-24.04
9482
- target: aarch64-unknown-linux-gnu/gcc
9583
architecture: aarch64
96-
runner: ubuntu-22.04
97-
compiler: gcc
98-
- target: aarch64-unknown-linux-gnu/clang
99-
architecture: aarch64
100-
runner: ubuntu-22.04
101-
compiler: clang
102-
env:
103-
CC: ${{ matrix.compiler }}
84+
# Forks don't have access to our paid AArch64 runners. These jobs are skipped below:
85+
runner: ${{ github.repository_owner == 'python' && 'ubuntu-24.04-aarch64' || 'ubuntu-24.04' }}
10486
steps:
10587
- uses: actions/checkout@v4
10688
- uses: actions/setup-python@v5
@@ -111,10 +93,10 @@ jobs:
11193
if: runner.os == 'Windows' && matrix.architecture != 'ARM64'
11294
run: |
11395
choco install llvm --allow-downgrade --no-progress --version ${{ matrix.llvm }}.1.0
114-
./PCbuild/build.bat --experimental-jit ${{ matrix.debug && '-d' || '--pgo' }} -p ${{ matrix.architecture }}
96+
./PCbuild/build.bat --experimental-jit ${{ matrix.debug && '-d' || '' }} -p ${{ matrix.architecture }}
11597
./PCbuild/rt.bat ${{ matrix.debug && '-d' || '' }} -p ${{ matrix.architecture }} -q --multiprocess 0 --timeout 4500 --verbose2 --verbose3
11698
117-
# No PGO or tests (yet):
99+
# No tests (yet):
118100
- name: Emulated Windows
119101
if: runner.os == 'Windows' && matrix.architecture == 'ARM64'
120102
run: |
@@ -123,7 +105,7 @@ jobs:
123105
124106
# The `find` line is required as a result of https://github.com/actions/runner-images/issues/9966.
125107
# This is a bug in the macOS runner image where the pre-installed Python is installed in the same
126-
# directory as the Homebrew Python, which causes the build to fail for macos-13. This line removes
108+
# directory as the Homebrew Python, which causes the build to fail for macos-13. This line removes
127109
# the symlink to the pre-installed Python so that the Homebrew Python is used instead.
128110
- name: Native macOS
129111
if: runner.os == 'macOS'
@@ -132,44 +114,24 @@ jobs:
132114
find /usr/local/bin -lname '*/Library/Frameworks/Python.framework/*' -delete
133115
brew install llvm@${{ matrix.llvm }}
134116
export SDKROOT="$(xcrun --show-sdk-path)"
135-
./configure --enable-experimental-jit ${{ matrix.debug && '--with-pydebug' || '--enable-optimizations --with-lto' }}
117+
./configure --enable-experimental-jit ${{ matrix.debug && '--with-pydebug' || '' }}
136118
make all --jobs 4
137119
./python.exe -m test --multiprocess 0 --timeout 4500 --verbose2 --verbose3
138120
139121
- name: Native Linux
140-
if: runner.os == 'Linux' && matrix.architecture == 'x86_64'
122+
# Forks don't have access to our paid AArch64 runners. Skip those:
123+
if: runner.os == 'Linux' && (matrix.architecture == 'x86_64' || github.repository_owner == 'python')
141124
run: |
142125
sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)" ./llvm.sh ${{ matrix.llvm }}
143126
export PATH="$(llvm-config-${{ matrix.llvm }} --bindir):$PATH"
144-
./configure --enable-experimental-jit ${{ matrix.debug && '--with-pydebug' || '--enable-optimizations --with-lto' }}
127+
./configure --enable-experimental-jit ${{ matrix.debug && '--with-pydebug' || '' }}
145128
make all --jobs 4
146129
./python -m test --multiprocess 0 --timeout 4500 --verbose2 --verbose3
147130
148-
- name: Emulated Linux
149-
if: runner.os == 'Linux' && matrix.architecture != 'x86_64'
150-
# The --ignorefile on ./python -m test is used to exclude tests known to fail when running on an emulated Linux.
151-
run: |
152-
sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)" ./llvm.sh ${{ matrix.llvm }}
153-
export PATH="$(llvm-config-${{ matrix.llvm }} --bindir):$PATH"
154-
./configure --prefix="$(pwd)/../build"
155-
make install --jobs 4
156-
make clean --jobs 4
157-
export HOST=${{ matrix.architecture }}-linux-gnu
158-
sudo apt install --yes "gcc-$HOST" qemu-user
159-
${{ !matrix.debug && matrix.compiler == 'clang' && './configure --enable-optimizations' || '' }}
160-
${{ !matrix.debug && matrix.compiler == 'clang' && 'make profile-run-stamp --jobs 4' || '' }}
161-
export QEMU_LD_PREFIX="/usr/$HOST"
162-
CC="${{ matrix.compiler == 'clang' && 'clang --target=$HOST' || '$HOST-gcc' }}" \
163-
CPP="$CC --preprocess" \
164-
HOSTRUNNER=qemu-${{ matrix.architecture }} \
165-
./configure --enable-experimental-jit ${{ matrix.debug && '--with-pydebug' || '--with-lto' }} --build=x86_64-linux-gnu --host="$HOST" --with-build-python=../build/bin/python3 --with-pkg-config=no ac_cv_buggy_getaddrinfo=no ac_cv_file__dev_ptc=no ac_cv_file__dev_ptmx=yes
166-
make all --jobs 4
167-
./python -m test --ignorefile=Tools/jit/ignore-tests-emulated-linux.txt --multiprocess 0 --timeout 4500 --verbose2 --verbose3
168-
169131
jit-with-disabled-gil:
170132
name: Free-Threaded (Debug)
171133
needs: interpreter
172-
runs-on: ubuntu-22.04
134+
runs-on: ubuntu-24.04
173135
strategy:
174136
matrix:
175137
llvm:

.github/workflows/reusable-macos.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,10 @@ jobs:
3737
path: config.cache
3838
key: ${{ github.job }}-${{ inputs.os }}-${{ env.IMAGE_VERSION }}-${{ inputs.config_hash }}
3939
- name: Install Homebrew dependencies
40-
run: brew install pkg-config [email protected] xz gdbm tcl-tk make
40+
run: |
41+
brew install pkg-config [email protected] xz gdbm tcl-tk@8 make
42+
# Because alternate versions are not symlinked into place by default:
43+
brew link tcl-tk@8
4144
- name: Configure CPython
4245
run: |
4346
GDBM_CFLAGS="-I$(brew --prefix gdbm)/include" \

.github/workflows/reusable-ubuntu.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@ on:
1111
required: false
1212
type: boolean
1313
default: false
14+
os:
15+
description: OS to run the job
16+
required: true
17+
type: string
1418

1519
jobs:
1620
build_ubuntu_reusable:
17-
name: 'build and test'
21+
name: build and test (${{ inputs.os }})
1822
timeout-minutes: 60
19-
runs-on: ${{ matrix.os }}
20-
strategy:
21-
fail-fast: false
22-
matrix:
23-
os: [ubuntu-24.04, ubuntu-24.04-aarch64]
23+
runs-on: ${{ inputs.os }}
2424
env:
2525
FORCE_COLOR: 1
2626
OPENSSL_VER: 3.0.15
@@ -42,7 +42,7 @@ jobs:
4242
uses: actions/cache@v4
4343
with:
4444
path: ./multissl/openssl/${{ env.OPENSSL_VER }}
45-
key: ${{ matrix.os }}-multissl-openssl-${{ env.OPENSSL_VER }}
45+
key: ${{ inputs.os }}-multissl-openssl-${{ env.OPENSSL_VER }}
4646
- name: Install OpenSSL
4747
if: steps.cache-openssl.outputs.cache-hit != 'true'
4848
run: python3 Tools/ssl/multissltests.py --steps=library --base-directory "$MULTISSL_DIR" --openssl "$OPENSSL_VER" --system Linux
@@ -84,7 +84,7 @@ jobs:
8484
working-directory: ${{ env.CPYTHON_BUILDDIR }}
8585
run: make -j
8686
- name: Build CPython out-of-tree (for compiler warning check)
87-
if: ${{ !inputs.free-threading}}
87+
if: ${{ !inputs.free-threading }}
8888
working-directory: ${{ env.CPYTHON_BUILDDIR }}
8989
run: set -o pipefail; make -j --output-sync 2>&1 | tee compiler_output_ubuntu.txt
9090
- name: Display build info

Doc/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ pydoc-topics: build
144144

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

150150
.PHONY: htmlview

Doc/c-api/complex.rst

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,36 @@ pointers. This is consistent throughout the API.
4444
representation.
4545
4646
47+
.. c:function:: Py_complex _Py_cr_sum(Py_complex left, double right)
48+
49+
Return the sum of a complex number and a real number, using the C :c:type:`Py_complex`
50+
representation.
51+
52+
.. versionadded:: 3.14
53+
54+
4755
.. c:function:: Py_complex _Py_c_diff(Py_complex left, Py_complex right)
4856
4957
Return the difference between two complex numbers, using the C
5058
:c:type:`Py_complex` representation.
5159
5260
61+
.. c:function:: Py_complex _Py_cr_diff(Py_complex left, double right)
62+
63+
Return the difference between a complex number and a real number, using the C
64+
:c:type:`Py_complex` representation.
65+
66+
.. versionadded:: 3.14
67+
68+
69+
.. c:function:: Py_complex _Py_rc_diff(double left, Py_complex right)
70+
71+
Return the difference between a real number and a complex number, using the C
72+
:c:type:`Py_complex` representation.
73+
74+
.. versionadded:: 3.14
75+
76+
5377
.. c:function:: Py_complex _Py_c_neg(Py_complex num)
5478
5579
Return the negation of the complex number *num*, using the C
@@ -62,6 +86,14 @@ pointers. This is consistent throughout the API.
6286
representation.
6387
6488
89+
.. c:function:: Py_complex _Py_cr_prod(Py_complex left, double right)
90+
91+
Return the product of a complex number and a real number, using the C
92+
:c:type:`Py_complex` representation.
93+
94+
.. versionadded:: 3.14
95+
96+
6597
.. c:function:: Py_complex _Py_c_quot(Py_complex dividend, Py_complex divisor)
6698
6799
Return the quotient of two complex numbers, using the C :c:type:`Py_complex`
@@ -71,6 +103,28 @@ pointers. This is consistent throughout the API.
71103
:c:data:`errno` to :c:macro:`!EDOM`.
72104
73105
106+
.. c:function:: Py_complex _Py_cr_quot(Py_complex dividend, double divisor)
107+
108+
Return the quotient of a complex number and a real number, using the C
109+
:c:type:`Py_complex` representation.
110+
111+
If *divisor* is zero, this method returns zero and sets
112+
:c:data:`errno` to :c:macro:`!EDOM`.
113+
114+
.. versionadded:: 3.14
115+
116+
117+
.. c:function:: Py_complex _Py_rc_quot(double dividend, Py_complex divisor)
118+
119+
Return the quotient of a real number and a complex number, using the C
120+
:c:type:`Py_complex` representation.
121+
122+
If *divisor* is zero, this method returns zero and sets
123+
:c:data:`errno` to :c:macro:`!EDOM`.
124+
125+
.. versionadded:: 3.14
126+
127+
74128
.. c:function:: Py_complex _Py_c_pow(Py_complex num, Py_complex exp)
75129
76130
Return the exponentiation of *num* by *exp*, using the C :c:type:`Py_complex`

Doc/c-api/exceptions.rst

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -853,12 +853,23 @@ The following functions are used to create and modify Unicode exceptions from C.
853853
*\*start*. *start* must not be ``NULL``. Return ``0`` on success, ``-1`` on
854854
failure.
855855
856+
If the :attr:`UnicodeError.object` is an empty sequence, the resulting
857+
*start* is ``0``. Otherwise, it is clipped to ``[0, len(object) - 1]``.
858+
859+
.. seealso:: :attr:`UnicodeError.start`
860+
856861
.. c:function:: int PyUnicodeDecodeError_SetStart(PyObject *exc, Py_ssize_t start)
857862
int PyUnicodeEncodeError_SetStart(PyObject *exc, Py_ssize_t start)
858863
int PyUnicodeTranslateError_SetStart(PyObject *exc, Py_ssize_t start)
859864
860-
Set the *start* attribute of the given exception object to *start*. Return
861-
``0`` on success, ``-1`` on failure.
865+
Set the *start* attribute of the given exception object to *start*.
866+
Return ``0`` on success, ``-1`` on failure.
867+
868+
.. note::
869+
870+
While passing a negative *start* does not raise an exception,
871+
the corresponding getters will not consider it as a relative
872+
offset.
862873
863874
.. c:function:: int PyUnicodeDecodeError_GetEnd(PyObject *exc, Py_ssize_t *end)
864875
int PyUnicodeEncodeError_GetEnd(PyObject *exc, Py_ssize_t *end)
@@ -868,13 +879,18 @@ The following functions are used to create and modify Unicode exceptions from C.
868879
*\*end*. *end* must not be ``NULL``. Return ``0`` on success, ``-1`` on
869880
failure.
870881
882+
If the :attr:`UnicodeError.object` is an empty sequence, the resulting
883+
*end* is ``0``. Otherwise, it is clipped to ``[1, len(object)]``.
884+
871885
.. c:function:: int PyUnicodeDecodeError_SetEnd(PyObject *exc, Py_ssize_t end)
872886
int PyUnicodeEncodeError_SetEnd(PyObject *exc, Py_ssize_t end)
873887
int PyUnicodeTranslateError_SetEnd(PyObject *exc, Py_ssize_t end)
874888
875889
Set the *end* attribute of the given exception object to *end*. Return ``0``
876890
on success, ``-1`` on failure.
877891
892+
.. seealso:: :attr:`UnicodeError.end`
893+
878894
.. c:function:: PyObject* PyUnicodeDecodeError_GetReason(PyObject *exc)
879895
PyObject* PyUnicodeEncodeError_GetReason(PyObject *exc)
880896
PyObject* PyUnicodeTranslateError_GetReason(PyObject *exc)

Doc/c-api/init_config.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1590,9 +1590,22 @@ If a ``._pth`` file is present:
15901590
* Set :c:member:`~PyConfig.site_import` to ``0``.
15911591
* Set :c:member:`~PyConfig.safe_path` to ``1``.
15921592
1593+
If :c:member:`~PyConfig.home` is not set and a ``pyvenv.cfg`` file is present in
1594+
the same directory as :c:member:`~PyConfig.executable`, or its parent,
1595+
:c:member:`~PyConfig.prefix` and :c:member:`~PyConfig.exec_prefix` are set that
1596+
location. When this happens, :c:member:`~PyConfig.base_prefix` and
1597+
:c:member:`~PyConfig.base_exec_prefix` still keep their value, pointing to the
1598+
base installation. See :ref:`sys-path-init-virtual-environments` for more
1599+
information.
1600+
15931601
The ``__PYVENV_LAUNCHER__`` environment variable is used to set
15941602
:c:member:`PyConfig.base_executable`.
15951603
1604+
.. versionchanged:: 3.14
1605+
1606+
:c:member:`~PyConfig.prefix`, and :c:member:`~PyConfig.exec_prefix`, are now
1607+
set to the ``pyvenv.cfg`` directory. This was previously done by :mod:`site`,
1608+
therefore affected by :option:`-S`.
15961609
15971610
.. _pyinitconfig_api:
15981611

Doc/c-api/object.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ Object Protocol
8585
instead of the :func:`repr`.
8686
8787
88-
.. c:function:: int PyObject_HasAttrWithError(PyObject *o, const char *attr_name)
88+
.. c:function:: int PyObject_HasAttrWithError(PyObject *o, PyObject *attr_name)
8989
9090
Returns ``1`` if *o* has the attribute *attr_name*, and ``0`` otherwise.
9191
This is equivalent to the Python expression ``hasattr(o, attr_name)``.

0 commit comments

Comments
 (0)