Skip to content

Commit d464f07

Browse files
committed
Merge remote-tracking branch 'origin/3.13' into HEAD
# Conflicts: # Lib/test/datetimetester.py
2 parents 96c10f1 + f7eae63 commit d464f07

130 files changed

Lines changed: 3074 additions & 474 deletions

File tree

Some content is hidden

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

.github/workflows/build.yml

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -246,16 +246,16 @@ jobs:
246246
strategy:
247247
fail-fast: false
248248
matrix:
249-
# macos-26 is Apple Silicon, macos-15-intel is Intel.
250-
# macos-15-intel only runs tests against the GIL-enabled CPython.
249+
# macos-26 is Apple Silicon, macos-26-intel is Intel.
250+
# macos-26-intel only runs tests against the GIL-enabled CPython.
251251
os:
252252
- macos-26
253-
- macos-15-intel
253+
- macos-26-intel
254254
free-threading:
255255
- false
256256
- true
257257
exclude:
258-
- os: macos-15-intel
258+
- os: macos-26-intel
259259
free-threading: true
260260
uses: ./.github/workflows/reusable-macos.yml
261261
with:
@@ -351,7 +351,7 @@ jobs:
351351
with:
352352
persist-credentials: false
353353
- name: Build and test
354-
run: ./Android/android.py ci --fast-ci ${{ matrix.arch }}-linux-android
354+
run: JAVA_HOME="${JAVA_HOME_21_X64:-$JAVA_HOME_21_arm64}" ./Android/android.py ci --fast-ci ${{ matrix.arch }}-linux-android
355355

356356
build-wasi:
357357
name: 'WASI'
@@ -486,10 +486,6 @@ jobs:
486486
run: echo "::add-matcher::.github/problem-matchers/gcc.json"
487487
- name: Install dependencies
488488
run: sudo ./.github/workflows/posix-deps-apt.sh
489-
- name: Set up GCC-10 for ASAN
490-
uses: egor-tensin/setup-gcc@a2861a8b8538f49cf2850980acccf6b05a1b2ae4 # v2.0
491-
with:
492-
version: 10
493489
- name: Configure OpenSSL env vars
494490
run: |
495491
echo "MULTISSL_DIR=${GITHUB_WORKSPACE}/multissl" >> "$GITHUB_ENV"

.github/workflows/reusable-docs.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,17 @@ name: Reusable Docs
33
on:
44
workflow_call:
55
workflow_dispatch:
6+
# Pushes to CPython branches seed the pip caches under the exact keys every
7+
# docs PR restores from. Without a branch-scoped copy, each PR saves a
8+
# duplicate into its own refs/pull/N/merge scope that nothing else can read.
9+
push:
10+
branches:
11+
- main
12+
- '3.*'
13+
paths:
14+
- 'Doc/pylock.toml'
15+
- 'Doc/requirements.txt'
16+
- '.github/workflows/reusable-docs.yml'
617

718
permissions:
819
contents: read

.readthedocs.yml

Lines changed: 46 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,50 @@ build:
1111
os: ubuntu-24.04
1212
tools:
1313
python: "3"
14+
apt_packages:
15+
- jq
1416

15-
commands:
16-
# https://docs.readthedocs.io/en/stable/build-customization.html#cancel-build-based-on-a-condition
17-
#
18-
# Cancel building pull requests when there aren't changes in the Doc directory.
19-
#
20-
# If there are no changes (git diff exits with 0) we force the command to return with 183.
21-
# This is a special exit code on Read the Docs that will cancel the build immediately.
22-
- |
23-
if [ "$READTHEDOCS_VERSION_TYPE" = "external" ] && [ "$(git diff --quiet origin/main -- Doc/ .readthedocs.yml; echo $?)" -eq 0 ];
24-
then
25-
echo "No changes to Doc/ - exiting the build.";
26-
exit 183;
27-
fi
28-
29-
- asdf plugin add uv
30-
- asdf install uv latest
31-
- asdf global uv latest
32-
- make -C Doc venv html
33-
- mkdir _readthedocs
34-
- mv Doc/build/html _readthedocs/html
17+
jobs:
18+
post_system_dependencies:
19+
# https://docs.readthedocs.com/platform/stable/guides/build/skip-build.html#skip-builds-based-on-conditions
20+
#
21+
# Cancel building pull requests when there are no changes in the Doc
22+
# directory or RTD configuration, or if we can't cleanly merge the base
23+
# branch.
24+
- |
25+
set -eEux;
26+
if [ "$READTHEDOCS_VERSION_TYPE" = "external" ];
27+
then
28+
base_branch=$(wget -qO- "https://api.github.com/repos/python/cpython/pulls/$READTHEDOCS_VERSION" | jq -er ".base.ref");
29+
git fetch --depth=50 origin $base_branch:origin-$base_branch;
30+
for attempt in $(seq 10);
31+
do
32+
if ! git merge-base HEAD origin-$base_branch;
33+
then
34+
git fetch --deepen=50 origin $base_branch;
35+
else
36+
break;
37+
fi;
38+
done;
39+
if ! git -c "user.name=rtd" -c "user.email=no-reply@readthedocs.org" merge --no-stat --no-edit origin-$base_branch;
40+
then
41+
echo "Unsuccessful merge with '$base_branch' branch, skipping the build";
42+
exit 183;
43+
fi;
44+
if git diff --exit-code --stat origin-$base_branch -- Doc/ .readthedocs.yml;
45+
then
46+
echo "No changes to Doc/ - skipping the build.";
47+
exit 183;
48+
fi;
49+
fi;
50+
create_environment:
51+
- echo "Skipping default environment creation"
52+
install:
53+
- asdf plugin add uv
54+
- asdf install uv latest
55+
- asdf global uv latest
56+
build:
57+
html:
58+
- make -C Doc venv html
59+
- mkdir -p "$READTHEDOCS_OUTPUT"
60+
- mv Doc/build/html "$READTHEDOCS_OUTPUT/"

Android/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ any packages it needs.
3131
The script also requires the following commands to be on the `PATH`:
3232

3333
* `curl`
34-
* `java` (or set the `JAVA_HOME` environment variable)
34+
* `java` (or set the `JAVA_HOME` environment variable).
35+
Java versions 17 and 21 are supported.
3536

3637

3738
## Building

Doc/c-api/bytes.rst

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -176,10 +176,11 @@ called with a non-bytes parameter.
176176
.. c:function:: void PyBytes_Concat(PyObject **bytes, PyObject *newpart)
177177
178178
Create a new bytes object in *\*bytes* containing the contents of *newpart*
179-
appended to *bytes*; the caller will own the new reference. The reference to
180-
the old value of *bytes* will be stolen. If the new object cannot be
181-
created, the old reference to *bytes* will still be discarded and the value
182-
of *\*bytes* will be set to ``NULL``; the appropriate exception will be set.
179+
appended to *bytes*; the caller will own the new reference.
180+
The reference to the old value of *bytes* will be ":term:`stolen <steal>`".
181+
If the new object cannot be created, the old reference to *bytes* will still
182+
be "stolen", the value of *\*bytes* will be set to ``NULL``, and
183+
the appropriate exception will be set.
183184
184185
185186
.. c:function:: void PyBytes_ConcatAndDel(PyObject **bytes, PyObject *newpart)

Doc/c-api/dict.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ Dictionary Objects
8484
8585
Insert *val* into the dictionary *p* with a key of *key*. *key* must be
8686
:term:`hashable`; if it isn't, :exc:`TypeError` will be raised. Return
87-
``0`` on success or ``-1`` on failure. This function *does not* steal a
88-
reference to *val*.
87+
``0`` on success or ``-1`` on failure.
88+
This function *does not* ":term:`steal`" a reference to *val*.
8989
9090
9191
.. c:function:: int PyDict_SetItemString(PyObject *p, const char *key, PyObject *val)

Doc/c-api/exceptions.rst

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,8 @@ Querying the error indicator
503503
504504
.. warning::
505505
506-
This call steals a reference to *exc*, which must be a valid exception.
506+
This call ":term:`steals <steal>`" a reference to *exc*,
507+
which must be a valid exception.
507508
508509
.. versionadded:: 3.12
509510
@@ -641,7 +642,8 @@ Querying the error indicator
641642
642643
Set the exception info, as known from ``sys.exc_info()``. This refers
643644
to an exception that was *already caught*, not to an exception that was
644-
freshly raised. This function steals the references of the arguments.
645+
freshly raised. This function ":term:`steals <steal>`" the references
646+
of the arguments.
645647
To clear the exception state, pass ``NULL`` for all three arguments.
646648
This function is kept for backwards compatibility. Prefer using
647649
:c:func:`PyErr_SetHandledException`.
@@ -658,8 +660,8 @@ Querying the error indicator
658660
.. versionchanged:: 3.11
659661
The ``type`` and ``traceback`` arguments are no longer used and
660662
can be NULL. The interpreter now derives them from the exception
661-
instance (the ``value`` argument). The function still steals
662-
references of all three arguments.
663+
instance (the ``value`` argument). The function still
664+
":term:`steals <steal>`" references of all three arguments.
663665
664666
665667
Signal Handling
@@ -845,7 +847,7 @@ Exception Objects
845847
846848
Set the context associated with the exception to *ctx*. Use ``NULL`` to clear
847849
it. There is no type check to make sure that *ctx* is an exception instance.
848-
This steals a reference to *ctx*.
850+
This ":term:`steals <steal>`" a reference to *ctx*.
849851
850852
851853
.. c:function:: PyObject* PyException_GetCause(PyObject *ex)
@@ -860,7 +862,8 @@ Exception Objects
860862
861863
Set the cause associated with the exception to *cause*. Use ``NULL`` to clear
862864
it. There is no type check to make sure that *cause* is either an exception
863-
instance or ``None``. This steals a reference to *cause*.
865+
instance or ``None``.
866+
This ":term:`steals <steal>`" a reference to *cause*.
864867
865868
The :attr:`~BaseException.__suppress_context__` attribute is implicitly set
866869
to ``True`` by this function.

Doc/c-api/gen.rst

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,15 @@ than explicitly calling :c:func:`PyGen_New` or :c:func:`PyGen_NewWithQualName`.
3535
.. c:function:: PyObject* PyGen_New(PyFrameObject *frame)
3636
3737
Create and return a new generator object based on the *frame* object.
38-
A reference to *frame* is stolen by this function. The argument must not be
39-
``NULL``.
38+
A reference to *frame* is ":term:`stolen <steal>`" by this function (even
39+
on error). The argument must not be ``NULL``.
4040
4141
.. c:function:: PyObject* PyGen_NewWithQualName(PyFrameObject *frame, PyObject *name, PyObject *qualname)
4242
4343
Create and return a new generator object based on the *frame* object,
4444
with ``__name__`` and ``__qualname__`` set to *name* and *qualname*.
45-
A reference to *frame* is stolen by this function. The *frame* argument
46-
must not be ``NULL``.
45+
A reference to *frame* is ":term:`stolen <steal>`" by this function (even
46+
on error). The *frame* argument must not be ``NULL``.
4747
4848
.. c:function:: PyCodeObject* PyGen_GetCode(PyGenObject *gen)
4949
@@ -67,8 +67,9 @@ Asynchronous Generator Objects
6767
.. c:function:: PyObject *PyAsyncGen_New(PyFrameObject *frame, PyObject *name, PyObject *qualname)
6868
6969
Create a new asynchronous generator wrapping *frame*, with ``__name__`` and
70-
``__qualname__`` set to *name* and *qualname*. *frame* is stolen by this
71-
function and must not be ``NULL``.
70+
``__qualname__`` set to *name* and *qualname*.
71+
*frame* is ":term:`stolen <steal>`" by this function (even on error) and
72+
must not be ``NULL``.
7273
7374
On success, this function returns a :term:`strong reference` to the
7475
new asynchronous generator. On failure, this function returns ``NULL``

Doc/c-api/intro.rst

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -592,9 +592,12 @@ the caller is said to *borrow* the reference. Nothing needs to be done for a
592592

593593
Conversely, when a calling function passes in a reference to an object, there
594594
are two possibilities: the function *steals* a reference to the object, or it
595-
does not. *Stealing a reference* means that when you pass a reference to a
596-
function, that function assumes that it now owns that reference, and you are not
597-
responsible for it any longer.
595+
does not.
596+
597+
*Stealing a reference* means that when you pass a reference to a
598+
function, that function assumes that it now owns that reference.
599+
Since the new owner can use :c:func:`!Py_DECREF` at its discretion,
600+
you (the caller) must not use that reference after the call.
598601

599602
.. index::
600603
single: PyList_SetItem (C function)

Doc/c-api/list.rst

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,10 @@ List Objects
8888
8989
.. note::
9090
91-
This function "steals" a reference to *item* and discards a reference to
92-
an item already in the list at the affected position.
91+
This function ":term:`steals <steal>`" a reference to *item*,
92+
even on error.
93+
On success, it discards a reference to an item already in the list
94+
at the affected position (unless it was ``NULL``).
9395
9496
9597
.. c:function:: void PyList_SET_ITEM(PyObject *list, Py_ssize_t i, PyObject *o)
@@ -103,7 +105,7 @@ List Objects
103105
104106
.. note::
105107
106-
This macro "steals" a reference to *item*, and, unlike
108+
This macro ":term:`steals <steal>`" a reference to *item*, and, unlike
107109
:c:func:`PyList_SetItem`, does *not* discard a reference to any item that
108110
is being replaced; any reference in *list* at position *i* will be
109111
leaked.

0 commit comments

Comments
 (0)