Skip to content

Commit e22cbcf

Browse files
Merge branch 'main' into BTPROTO_SCO-FreeBSD
2 parents 10ee7ae + 26ae05e commit e22cbcf

File tree

340 files changed

+16043
-3408
lines changed

Some content is hidden

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

340 files changed

+16043
-3408
lines changed

.azure-pipelines/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
trigger: ['main', '3.13', '3.12', '3.11', '3.10', '3.9', '3.8']
1+
trigger: ['main', '3.*']
22

33
jobs:
44
- job: Prebuild

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ Please read this comment in its entirety. It's quite important.
77
It should be in the following format:
88
99
```
10-
gh-NNNNN: Summary of the changes made
10+
gh-NNNNNN: Summary of the changes made
1111
```
1212
13-
Where: gh-NNNNN refers to the GitHub issue number.
13+
Where: gh-NNNNNN refers to the GitHub issue number.
1414
1515
Most PRs will require an issue number. Trivial changes, like fixing a typo, do not need an issue.
1616
@@ -20,11 +20,11 @@ If this is a backport PR (PR made against branches other than `main`),
2020
please ensure that the PR title is in the following format:
2121
2222
```
23-
[X.Y] <title from the original PR> (GH-NNNN)
23+
[X.Y] <title from the original PR> (GH-NNNNNN)
2424
```
2525
26-
Where: [X.Y] is the branch name, e.g. [3.6].
26+
Where: [X.Y] is the branch name, for example: [3.13].
2727
28-
GH-NNNN refers to the PR number from `main`.
28+
GH-NNNNNN refers to the PR number from `main`.
2929
3030
-->

.github/workflows/mypy.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,5 @@ jobs:
5959
cache: pip
6060
cache-dependency-path: Tools/requirements-dev.txt
6161
- run: pip install -r Tools/requirements-dev.txt
62+
- run: python3 Misc/mypy/make_symlinks.py --symlink
6263
- run: mypy --config-file ${{ matrix.target }}/mypy.ini

.github/workflows/tail-call.yml

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs:
4545
- aarch64-unknown-linux-gnu/gcc
4646
- free-threading
4747
llvm:
48-
- 19
48+
- 20
4949
include:
5050
# - target: i686-pc-windows-msvc/msvc
5151
# architecture: Win32
@@ -83,9 +83,9 @@ jobs:
8383
if: runner.os == 'Windows' && matrix.architecture != 'ARM64'
8484
shell: cmd
8585
run: |
86-
choco install llvm --allow-downgrade --no-progress --version ${{ matrix.llvm }}.1.5
86+
choco install llvm --allow-downgrade --no-progress --version ${{ matrix.llvm }}.1.0
8787
set PlatformToolset=clangcl
88-
set LLVMToolsVersion=${{ matrix.llvm }}.1.5
88+
set LLVMToolsVersion=${{ matrix.llvm }}.1.0
8989
set LLVMInstallDir=C:\Program Files\LLVM
9090
call ./PCbuild/build.bat --tail-call-interp -d -p ${{ matrix.architecture }}
9191
call ./PCbuild/rt.bat -d -p ${{ matrix.architecture }} -q --multiprocess 0 --timeout 4500 --verbose2 --verbose3
@@ -95,26 +95,28 @@ jobs:
9595
if: runner.os == 'Windows' && matrix.architecture == 'ARM64'
9696
shell: cmd
9797
run: |
98-
choco install llvm --allow-downgrade --no-progress --version ${{ matrix.llvm }}.1.5
98+
choco install llvm --allow-downgrade --no-progress --version ${{ matrix.llvm }}.1.0
9999
set PlatformToolset=clangcl
100-
set LLVMToolsVersion=${{ matrix.llvm }}.1.5
100+
set LLVMToolsVersion=${{ matrix.llvm }}.1.0
101101
set LLVMInstallDir=C:\Program Files\LLVM
102102
./PCbuild/build.bat --tail-call-interp -p ${{ matrix.architecture }}
103103
104104
# The `find` line is required as a result of https://github.com/actions/runner-images/issues/9966.
105105
# This is a bug in the macOS runner image where the pre-installed Python is installed in the same
106106
# directory as the Homebrew Python, which causes the build to fail for macos-13. This line removes
107107
# the symlink to the pre-installed Python so that the Homebrew Python is used instead.
108+
# Note: when a new LLVM is released, the homebrew installation directory changes, so the builds will fail.
109+
# We either need to upgrade LLVM or change the directory being pointed to.
108110
- name: Native macOS (release)
109111
if: runner.os == 'macOS'
110112
run: |
111113
brew update
112114
find /usr/local/bin -lname '*/Library/Frameworks/Python.framework/*' -delete
113115
brew install llvm@${{ matrix.llvm }}
114116
export SDKROOT="$(xcrun --show-sdk-path)"
115-
export PATH="/opt/homebrew/opt/llvm@${{ matrix.llvm }}/bin:$PATH"
116-
export PATH="/usr/local/opt/llvm@${{ matrix.llvm }}/bin:$PATH"
117-
CC=clang-19 ./configure --with-tail-call-interp
117+
export PATH="/usr/local/opt/llvm/bin:$PATH"
118+
export PATH="/opt/homebrew/opt/llvm/bin:$PATH"
119+
CC=clang-20 ./configure --with-tail-call-interp
118120
make all --jobs 4
119121
./python.exe -m test --multiprocess 0 --timeout 4500 --verbose2 --verbose3
120122
@@ -123,7 +125,7 @@ jobs:
123125
run: |
124126
sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)" ./llvm.sh ${{ matrix.llvm }}
125127
export PATH="$(llvm-config-${{ matrix.llvm }} --bindir):$PATH"
126-
CC=clang-19 ./configure --with-tail-call-interp --with-pydebug
128+
CC=clang-20 ./configure --with-tail-call-interp --with-pydebug
127129
make all --jobs 4
128130
./python -m test --multiprocess 0 --timeout 4500 --verbose2 --verbose3
129131
@@ -132,7 +134,7 @@ jobs:
132134
run: |
133135
sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)" ./llvm.sh ${{ matrix.llvm }}
134136
export PATH="$(llvm-config-${{ matrix.llvm }} --bindir):$PATH"
135-
CC=clang-19 ./configure --with-tail-call-interp --disable-gil
137+
CC=clang-20 ./configure --with-tail-call-interp --disable-gil
136138
make all --jobs 4
137139
./python -m test --multiprocess 0 --timeout 4500 --verbose2 --verbose3
138140

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ tags
3838
TAGS
3939
.vs/
4040
.vscode/
41+
.cache/
4142
gmon.out
4243
.coverage
4344
.mypy_cache/

Doc/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ dist-html:
204204
find dist -name 'python-$(DISTVERSION)-docs-html*' -exec rm -rf {} \;
205205
$(MAKE) html
206206
cp -pPR build/html dist/python-$(DISTVERSION)-docs-html
207+
rm -rf dist/python-$(DISTVERSION)-docs-html/_images/social_previews/
207208
tar -C dist -cf dist/python-$(DISTVERSION)-docs-html.tar python-$(DISTVERSION)-docs-html
208209
bzip2 -9 -k dist/python-$(DISTVERSION)-docs-html.tar
209210
(cd dist; zip -q -r -9 python-$(DISTVERSION)-docs-html.zip python-$(DISTVERSION)-docs-html)

Doc/c-api/arg.rst

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,14 +113,18 @@ There are three ways strings and buffers can be converted to C:
113113
``z`` (:class:`str` or ``None``) [const char \*]
114114
Like ``s``, but the Python object may also be ``None``, in which case the C
115115
pointer is set to ``NULL``.
116+
It is the same as ``s?`` with the C pointer was initialized to ``NULL``.
116117

117118
``z*`` (:class:`str`, :term:`bytes-like object` or ``None``) [Py_buffer]
118119
Like ``s*``, but the Python object may also be ``None``, in which case the
119120
``buf`` member of the :c:type:`Py_buffer` structure is set to ``NULL``.
121+
It is the same as ``s*?`` with the ``buf`` member of the :c:type:`Py_buffer`
122+
structure was initialized to ``NULL``.
120123

121124
``z#`` (:class:`str`, read-only :term:`bytes-like object` or ``None``) [const char \*, :c:type:`Py_ssize_t`]
122125
Like ``s#``, but the Python object may also be ``None``, in which case the C
123126
pointer is set to ``NULL``.
127+
It is the same as ``s#?`` with the C pointer was initialized to ``NULL``.
124128

125129
``y`` (read-only :term:`bytes-like object`) [const char \*]
126130
This format converts a bytes-like object to a C pointer to a
@@ -357,11 +361,37 @@ Other objects
357361

358362
.. versionadded:: 3.3
359363

360-
``(items)`` (:class:`tuple`) [*matching-items*]
361-
The object must be a Python sequence whose length is the number of format units
364+
``(items)`` (sequence) [*matching-items*]
365+
The object must be a Python sequence (except :class:`str`, :class:`bytes`
366+
or :class:`bytearray`) whose length is the number of format units
362367
in *items*. The C arguments must correspond to the individual format units in
363368
*items*. Format units for sequences may be nested.
364369

370+
If *items* contains format units which store a :ref:`borrowed buffer
371+
<c-arg-borrowed-buffer>` (``s``, ``s#``, ``z``, ``z#``, ``y``, or ``y#``)
372+
or a :term:`borrowed reference` (``S``, ``Y``, ``U``, ``O``, or ``O!``),
373+
the object must be a Python tuple.
374+
The *converter* for the ``O&`` format unit in *items* must not store
375+
a borrowed buffer or a borrowed reference.
376+
377+
.. versionchanged:: next
378+
:class:`str` and :class:`bytearray` objects no longer accepted as a sequence.
379+
380+
.. deprecated:: next
381+
Non-tuple sequences are deprecated if *items* contains format units
382+
which store a borrowed buffer or a borrowed reference.
383+
384+
``unit?`` (anything or ``None``) [*matching-variable(s)*]
385+
``?`` modifies the behavior of the preceding format unit.
386+
The C variable(s) corresponding to that parameter should be initialized
387+
to their default value --- when the argument is ``None``,
388+
:c:func:`PyArg_ParseTuple` does not touch the contents of the corresponding
389+
C variable(s).
390+
If the argument is not ``None``, it is parsed according to the specified
391+
format unit.
392+
393+
.. versionadded:: next
394+
365395
A few other characters have a meaning in a format string. These may not occur
366396
inside nested parentheses. They are:
367397

Doc/c-api/buffer.rst

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,19 @@ characteristic of being backed by a possibly large memory buffer. It is
2626
then desirable, in some situations, to access that buffer directly and
2727
without intermediate copying.
2828

29-
Python provides such a facility at the C level in the form of the :ref:`buffer
30-
protocol <bufferobjects>`. This protocol has two sides:
29+
Python provides such a facility at the C and Python level in the form of the
30+
:ref:`buffer protocol <bufferobjects>`. This protocol has two sides:
3131

3232
.. index:: single: PyBufferProcs (C type)
3333

3434
- on the producer side, a type can export a "buffer interface" which allows
3535
objects of that type to expose information about their underlying buffer.
36-
This interface is described in the section :ref:`buffer-structs`;
36+
This interface is described in the section :ref:`buffer-structs`; for
37+
Python see :ref:`python-buffer-protocol`.
3738

3839
- on the consumer side, several means are available to obtain a pointer to
39-
the raw underlying data of an object (for example a method parameter).
40+
the raw underlying data of an object (for example a method parameter). For
41+
Python see :class:`memoryview`.
4042

4143
Simple objects such as :class:`bytes` and :class:`bytearray` expose their
4244
underlying buffer in byte-oriented form. Other forms are possible; for example,
@@ -62,6 +64,10 @@ In both cases, :c:func:`PyBuffer_Release` must be called when the buffer
6264
isn't needed anymore. Failure to do so could lead to various issues such as
6365
resource leaks.
6466

67+
.. versionadded:: 3.12
68+
69+
The buffer protocol is now accessible in Python, see
70+
:ref:`python-buffer-protocol` and :class:`memoryview`.
6571

6672
.. _buffer-structure:
6773

Doc/c-api/monitoring.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,6 @@ would typically correspond to a python function.
205205
206206
.. versionadded:: 3.13
207207
208-
.. deprecated:: next
208+
.. deprecated:: 3.14
209209
210210
This function is :term:`soft deprecated`.

Doc/c-api/typeobj.rst

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -703,10 +703,13 @@ and :c:data:`PyType_Type` effectively act as defaults.)
703703

704704
.. code-block:: c
705705
706-
static void foo_dealloc(foo_object *self) {
706+
static void
707+
foo_dealloc(PyObject *op)
708+
{
709+
foo_object *self = (foo_object *) op;
707710
PyObject_GC_UnTrack(self);
708711
Py_CLEAR(self->ref);
709-
Py_TYPE(self)->tp_free((PyObject *)self);
712+
Py_TYPE(self)->tp_free(self);
710713
}
711714
712715
Finally, if the type is heap allocated (:c:macro:`Py_TPFLAGS_HEAPTYPE`), the
@@ -717,10 +720,12 @@ and :c:data:`PyType_Type` effectively act as defaults.)
717720

718721
.. code-block:: c
719722
720-
static void foo_dealloc(foo_object *self) {
721-
PyTypeObject *tp = Py_TYPE(self);
723+
static void
724+
foo_dealloc(PyObject *op)
725+
{
726+
PyTypeObject *tp = Py_TYPE(op);
722727
// free references and buffers here
723-
tp->tp_free(self);
728+
tp->tp_free(op);
724729
Py_DECREF(tp);
725730
}
726731
@@ -1416,8 +1421,9 @@ and :c:data:`PyType_Type` effectively act as defaults.)
14161421
:mod:`!_thread` extension module::
14171422

14181423
static int
1419-
local_traverse(localobject *self, visitproc visit, void *arg)
1424+
local_traverse(PyObject *op, visitproc visit, void *arg)
14201425
{
1426+
localobject *self = (localobject *) op;
14211427
Py_VISIT(self->args);
14221428
Py_VISIT(self->kw);
14231429
Py_VISIT(self->dict);
@@ -1511,8 +1517,9 @@ and :c:data:`PyType_Type` effectively act as defaults.)
15111517
members to ``NULL``, as in the following example::
15121518

15131519
static int
1514-
local_clear(localobject *self)
1520+
local_clear(PyObject *op)
15151521
{
1522+
localobject *self = (localobject *) op;
15161523
Py_CLEAR(self->key);
15171524
Py_CLEAR(self->args);
15181525
Py_CLEAR(self->kw);

0 commit comments

Comments
 (0)