Skip to content

Commit 47870c4

Browse files
committed
Merge branch 'main' into ios-testbed-wrapper
2 parents d9ef983 + d8d12b3 commit 47870c4

File tree

145 files changed

+3350
-2256
lines changed

Some content is hidden

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

145 files changed

+3350
-2256
lines changed

.github/workflows/build.yml

Lines changed: 10 additions & 1 deletion
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'

.github/workflows/jit.yml

Lines changed: 7 additions & 24 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
@@ -78,10 +78,11 @@ jobs:
7878
runner: macos-14
7979
- target: x86_64-unknown-linux-gnu/gcc
8080
architecture: x86_64
81-
runner: ubuntu-22.04
81+
runner: ubuntu-24.04
8282
- target: aarch64-unknown-linux-gnu/gcc
8383
architecture: aarch64
84-
runner: ubuntu-22.04
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' }}
8586
steps:
8687
- uses: actions/checkout@v4
8788
- uses: actions/setup-python@v5
@@ -118,37 +119,19 @@ jobs:
118119
./python.exe -m test --multiprocess 0 --timeout 4500 --verbose2 --verbose3
119120
120121
- name: Native Linux
121-
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')
122124
run: |
123125
sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)" ./llvm.sh ${{ matrix.llvm }}
124126
export PATH="$(llvm-config-${{ matrix.llvm }} --bindir):$PATH"
125127
./configure --enable-experimental-jit ${{ matrix.debug && '--with-pydebug' || '' }}
126128
make all --jobs 4
127129
./python -m test --multiprocess 0 --timeout 4500 --verbose2 --verbose3
128130
129-
- name: Emulated Linux
130-
if: runner.os == 'Linux' && matrix.architecture != 'x86_64'
131-
# The --ignorefile on ./python -m test is used to exclude tests known to fail when running on an emulated Linux.
132-
run: |
133-
sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)" ./llvm.sh ${{ matrix.llvm }}
134-
export PATH="$(llvm-config-${{ matrix.llvm }} --bindir):$PATH"
135-
./configure --prefix="$(pwd)/../build"
136-
make install --jobs 4
137-
make clean --jobs 4
138-
export HOST=${{ matrix.architecture }}-linux-gnu
139-
sudo apt install --yes "gcc-$HOST" qemu-user
140-
export QEMU_LD_PREFIX="/usr/$HOST"
141-
CC="$HOST-gcc" \
142-
CPP="$HOST-gcc --preprocess" \
143-
HOSTRUNNER=qemu-${{ matrix.architecture }} \
144-
./configure --enable-experimental-jit ${{ matrix.debug && '--with-pydebug' || '' }} --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
145-
make all --jobs 4
146-
./python -m test --ignorefile=Tools/jit/ignore-tests-emulated-linux.txt --multiprocess 0 --timeout 4500 --verbose2 --verbose3
147-
148131
jit-with-disabled-gil:
149132
name: Free-Threaded (Debug)
150133
needs: interpreter
151-
runs-on: ubuntu-22.04
134+
runs-on: ubuntu-24.04
152135
strategy:
153136
matrix:
154137
llvm:

.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/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/unicode.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1588,6 +1588,11 @@ object.
15881588
15891589
Create a Unicode writer instance.
15901590
1591+
*length* must be greater than or equal to ``0``.
1592+
1593+
If *length* is greater than ``0``, preallocate an internal buffer of
1594+
*length* characters.
1595+
15911596
Set an exception and return ``NULL`` on error.
15921597
15931598
.. c:function:: PyObject* PyUnicodeWriter_Finish(PyUnicodeWriter *writer)
@@ -1596,12 +1601,16 @@ object.
15961601
15971602
Set an exception and return ``NULL`` on error.
15981603
1604+
The writer instance is invalid after this call.
1605+
15991606
.. c:function:: void PyUnicodeWriter_Discard(PyUnicodeWriter *writer)
16001607
16011608
Discard the internal Unicode buffer and destroy the writer instance.
16021609
16031610
If *writer* is ``NULL``, no operation is performed.
16041611
1612+
The writer instance is invalid after this call.
1613+
16051614
.. c:function:: int PyUnicodeWriter_WriteChar(PyUnicodeWriter *writer, Py_UCS4 ch)
16061615
16071616
Write the single Unicode character *ch* into *writer*.

Doc/conf.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,13 @@
7878
.. |python_version_literal| replace:: ``Python {version}``
7979
.. |python_x_dot_y_literal| replace:: ``python{version}``
8080
.. |usr_local_bin_python_x_dot_y_literal| replace:: ``/usr/local/bin/python{version}``
81+
82+
.. Apparently this how you hack together a formatted link:
83+
(https://www.docutils.org/docs/ref/rst/directives.html#replacement-text)
84+
.. |FORCE_COLOR| replace:: ``FORCE_COLOR``
85+
.. _FORCE_COLOR: https://force-color.org/
86+
.. |NO_COLOR| replace:: ``NO_COLOR``
87+
.. _NO_COLOR: https://no-color.org/
8188
"""
8289

8390
# There are two options for replacing |today|. Either, you set today to some

Doc/howto/gdb_helpers.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ regular machine-level integer::
180180
(gdb) p some_python_integer
181181
$4 = 42
182182

183-
The internal structure can be revealed with a cast to :c:expr:`PyLongObject *`:
183+
The internal structure can be revealed with a cast to :c:expr:`PyLongObject *`::
184184

185185
(gdb) p *(PyLongObject*)some_python_integer
186186
$5 = {ob_base = {ob_base = {ob_refcnt = 8, ob_type = 0x3dad39f5e0}, ob_size = 1},

Doc/library/dis.rst

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ interpreter.
6060
The :option:`-P <dis --show-positions>` command-line option
6161
and the ``show_positions`` argument were added.
6262

63+
The :option:`-S <dis --specialized>` command-line option is added.
64+
6365
Example: Given the function :func:`!myfunc`::
6466

6567
def myfunc(alist):
@@ -89,7 +91,7 @@ The :mod:`dis` module can be invoked as a script from the command line:
8991

9092
.. code-block:: sh
9193
92-
python -m dis [-h] [-C] [-O] [-P] [infile]
94+
python -m dis [-h] [-C] [-O] [-P] [-S] [infile]
9395
9496
The following options are accepted:
9597

@@ -111,6 +113,10 @@ The following options are accepted:
111113

112114
Show positions of instructions in the source code.
113115

116+
.. cmdoption:: -S, --specialized
117+
118+
Show specialized bytecode.
119+
114120
If :file:`infile` is specified, its disassembled code will be written to stdout.
115121
Otherwise, disassembly is performed on compiled source code received from stdin.
116122

Doc/library/doctest.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,10 @@ examples of doctests in the standard Python test suite and libraries.
136136
Especially useful examples can be found in the standard test file
137137
:file:`Lib/test/test_doctest/test_doctest.py`.
138138

139+
.. versionadded:: 3.13
140+
Output is colorized by default and can be
141+
:ref:`controlled using environment variables <using-on-controlling-color>`.
142+
139143

140144
.. _doctest-simple-testmod:
141145

Doc/library/exceptions.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -644,10 +644,16 @@ The following exceptions are the exceptions that are usually raised.
644644

645645
The first index of invalid data in :attr:`object`.
646646

647+
This value should not be negative as it is interpreted as an
648+
absolute offset but this constraint is not enforced at runtime.
649+
647650
.. attribute:: end
648651

649652
The index after the last invalid data in :attr:`object`.
650653

654+
This value should not be negative as it is interpreted as an
655+
absolute offset but this constraint is not enforced at runtime.
656+
651657

652658
.. exception:: UnicodeEncodeError
653659

Doc/library/pathlib.rst

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1289,35 +1289,6 @@ Reading directories
12891289
raised.
12901290

12911291

1292-
.. method:: Path.scandir()
1293-
1294-
When the path points to a directory, return an iterator of
1295-
:class:`os.DirEntry` objects corresponding to entries in the directory. The
1296-
returned iterator supports the :term:`context manager` protocol. It is
1297-
implemented using :func:`os.scandir` and gives the same guarantees.
1298-
1299-
Using :meth:`~Path.scandir` instead of :meth:`~Path.iterdir` can
1300-
significantly increase the performance of code that also needs file type or
1301-
file attribute information, because :class:`os.DirEntry` objects expose
1302-
this information if the operating system provides it when scanning a
1303-
directory.
1304-
1305-
The following example displays the names of subdirectories. The
1306-
``entry.is_dir()`` check will generally not make an additional system call::
1307-
1308-
>>> p = Path('docs')
1309-
>>> with p.scandir() as entries:
1310-
... for entry in entries:
1311-
... if entry.is_dir():
1312-
... entry.name
1313-
...
1314-
'_templates'
1315-
'_build'
1316-
'_static'
1317-
1318-
.. versionadded:: 3.14
1319-
1320-
13211292
.. method:: Path.glob(pattern, *, case_sensitive=None, recurse_symlinks=False)
13221293

13231294
Glob the given relative *pattern* in the directory represented by this path,

Doc/library/select.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,11 +317,17 @@ Edge and Level Trigger Polling (epoll) Objects
317317
+-------------------------+-----------------------------------------------+
318318
| :const:`EPOLLMSG` | Ignored. |
319319
+-------------------------+-----------------------------------------------+
320+
| :const:`EPOLLWAKEUP` | Prevents sleep during event waiting. |
321+
+-------------------------+-----------------------------------------------+
320322

321323
.. versionadded:: 3.6
322324
:const:`EPOLLEXCLUSIVE` was added. It's only supported by Linux Kernel 4.5
323325
or later.
324326

327+
.. versionadded:: next
328+
:const:`EPOLLWAKEUP` was added. It's only supported by Linux Kernel 3.5
329+
or later.
330+
325331
.. method:: epoll.close()
326332

327333
Close the control file descriptor of the epoll object.

Doc/library/traceback.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ The module's API can be divided into two parts:
4444
necessary for later formatting without holding references to actual exception
4545
and traceback objects.
4646

47+
.. versionadded:: 3.13
48+
Output is colorized by default and can be
49+
:ref:`controlled using environment variables <using-on-controlling-color>`.
50+
4751

4852
Module-Level Functions
4953
----------------------

Doc/library/unittest.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ test runner
4646
a textual interface, or return a special value to indicate the results of
4747
executing the tests.
4848

49-
5049
.. seealso::
5150

5251
Module :mod:`doctest`
@@ -198,6 +197,9 @@ For a list of all the command-line options::
198197
In earlier versions it was only possible to run individual test methods and
199198
not modules or classes.
200199

200+
.. versionadded:: 3.14
201+
Output is colorized by default and can be
202+
:ref:`controlled using environment variables <using-on-controlling-color>`.
201203

202204
Command-line options
203205
~~~~~~~~~~~~~~~~~~~~

0 commit comments

Comments
 (0)