Skip to content

Commit fe6a3d5

Browse files
authored
Merge branch '3.15' into backport-010bebb-3.15
2 parents 560fc15 + 29064d6 commit fe6a3d5

631 files changed

Lines changed: 20911 additions & 7348 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/CODEOWNERS‎

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -287,11 +287,10 @@ Programs/_bootstrap_python.c @ericsnowcurrently @FFY00
287287
Programs/python.c @ericsnowcurrently @FFY00
288288

289289
# JIT
290-
.github/workflows/jit.yml @savannahostrowski
291-
Include/internal/pycore_jit.h @brandtbucher @savannahostrowski @diegorusso
292-
Python/jit.c @brandtbucher @savannahostrowski @diegorusso
293-
Tools/jit/ @brandtbucher @savannahostrowski @diegorusso
294-
InternalDocs/jit.md @brandtbucher @savannahostrowski @diegorusso @AA-Turner
290+
Include/internal/pycore_jit.h @brandtbucher @diegorusso
291+
Python/jit.c @brandtbucher @diegorusso
292+
Tools/jit/ @brandtbucher @diegorusso
293+
InternalDocs/jit.md @brandtbucher @diegorusso @AA-Turner
295294

296295
# Lazy imports (PEP 810)
297296
Objects/lazyimportobject.c @yhg1s @DinoV @pablogsal
@@ -300,9 +299,9 @@ Lib/test/test_lazy_import @yhg1s @DinoV @pablogsal
300299

301300
# Micro-op / μop / Tier 2 Optimiser
302301
Python/optimizer.c @markshannon @Fidget-Spinner
303-
Python/optimizer_analysis.c @markshannon @tomasr8 @Fidget-Spinner @savannahostrowski
304-
Python/optimizer_bytecodes.c @markshannon @tomasr8 @Fidget-Spinner @savannahostrowski
305-
Python/optimizer_symbols.c @markshannon @tomasr8 @Fidget-Spinner @savannahostrowski
302+
Python/optimizer_analysis.c @markshannon @tomasr8 @Fidget-Spinner
303+
Python/optimizer_bytecodes.c @markshannon @tomasr8 @Fidget-Spinner
304+
Python/optimizer_symbols.c @markshannon @tomasr8 @Fidget-Spinner
306305

307306
# Parser, Lexer, and Grammar
308307
Grammar/python.gram @pablogsal @lysnikolaou

‎.github/workflows/jit.yml‎

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -87,24 +87,16 @@ jobs:
8787
./PCbuild/rt.bat ${{ matrix.debug && '-d' || '' }} -p ${{ matrix.architecture }} -q --multiprocess 0 --timeout 4500 --verbose2 --verbose3
8888
8989
macos:
90-
name: ${{ matrix.target }} (${{ matrix.debug && 'Debug' || 'Release' }})
90+
name: aarch64-apple-darwin/clang (${{ matrix.debug && 'Debug' || 'Release' }})
9191

92-
runs-on: ${{ matrix.runner }}
92+
runs-on: macos-26
9393
timeout-minutes: 60
9494
strategy:
9595
fail-fast: false
9696
matrix:
97-
target:
98-
- x86_64-apple-darwin/clang
99-
- aarch64-apple-darwin/clang
10097
debug:
10198
- true
10299
- false
103-
include:
104-
- target: x86_64-apple-darwin/clang
105-
runner: macos-26-intel
106-
- target: aarch64-apple-darwin/clang
107-
runner: macos-26
108100
steps:
109101
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
110102
with:

‎.github/workflows/tail-call.yml‎

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,9 @@ env:
2424

2525
jobs:
2626
macos:
27-
name: ${{ matrix.target }}
28-
runs-on: ${{ matrix.runner }}
27+
name: aarch64-apple-darwin/clang
28+
runs-on: macos-26
2929
timeout-minutes: 60
30-
strategy:
31-
fail-fast: false
32-
matrix:
33-
include:
34-
- target: x86_64-apple-darwin/clang
35-
runner: macos-26-intel
36-
- target: aarch64-apple-darwin/clang
37-
runner: macos-26
3830
steps:
3931
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
4032
with:
@@ -49,7 +41,6 @@ jobs:
4941
- name: Build
5042
run: |
5143
export SDKROOT="$(xcrun --show-sdk-path)"
52-
export PATH="/usr/local/opt/llvm@${{ env.LLVM_VERSION }}/bin:$PATH"
5344
export PATH="/opt/homebrew/opt/llvm@${{ env.LLVM_VERSION }}/bin:$PATH"
5445
CC=clang-${{ env.LLVM_VERSION }} ./configure --with-tail-call-interp
5546
make all --jobs 4

‎.gitignore‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,3 +181,6 @@ Python/frozen_modules/MANIFEST
181181
# People's custom https://docs.anthropic.com/en/docs/claude-code/memory configs.
182182
/.claude/
183183
CLAUDE.local.md
184+
185+
# Local scratch space for things we or our agents do in our worktrees.
186+
/do-not-commit/

‎Doc/README.rst‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ tree but are maintained separately and are available from
2121
* `Sphinx <https://pypi.org/project/Sphinx/>`_
2222
* `blurb <https://pypi.org/project/blurb/>`_
2323
* `python-docs-theme <https://pypi.org/project/python-docs-theme/>`_
24+
* `sphinx-linklint <https://pypi.org/project/sphinx-linklint/>`_
2425

2526
The easiest way to install these tools is to create a virtual environment and
2627
install the tools into there.
@@ -57,6 +58,8 @@ Available make targets are:
5758
* "venv", which creates a virtual environment with all necessary tools
5859
installed.
5960

61+
* "lock", which regenerates the pinned dependencies in ``pylock.toml``.
62+
6063
* "html", which builds standalone HTML files for offline viewing.
6164

6265
* "htmlview", which re-uses the "html" builder, but then opens the main page
@@ -79,6 +82,9 @@ Available make targets are:
7982

8083
* "text", which builds a plain text file for each source file.
8184

85+
* "texinfo", which builds Texinfo source files as input to ``makeinfo`` to
86+
produce Info documents.
87+
8288
* "epub", which builds an EPUB document, suitable to be viewed on e-book
8389
readers.
8490

@@ -97,6 +103,10 @@ Available make targets are:
97103
plain text documentation for the labels defined in
98104
``tools/pyspecific.py`` -- pydoc needs these to show topic and keyword help.
99105

106+
* "doctest", which runs doctests in the documentation.
107+
108+
* "gettext", which generates gettext message catalog templates.
109+
100110
* "check", which checks for frequent markup errors.
101111

102112
* "dist", (Unix only) which creates distributable archives of HTML, text,

‎Doc/builtins/functions.rst‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,10 @@ are always available. They are listed here in alphabetical order.
314314
consists of a single expression, or ``'single'`` if it consists of a single
315315
interactive statement (in the latter case, expression statements that
316316
evaluate to something other than ``None`` will be printed).
317+
It can also be ``'func_type'`` if *source* consists of a
318+
function type signature, for example ``(int) -> str``; see
319+
:func:`ast.parse` for more information. This mode requires passing
320+
:data:`ast.PyCF_ONLY_AST` in *flags*.
317321

318322
The optional arguments *flags* and *dont_inherit* control which
319323
:ref:`compiler options <ast-compiler-flags>` should be activated
@@ -387,6 +391,9 @@ are always available. They are listed here in alphabetical order.
387391
``ast.PyCF_ALLOW_TOP_LEVEL_AWAIT`` can now be passed in flags to enable
388392
support for top-level ``await``, ``async for``, and ``async with``.
389393

394+
.. versionchanged:: 3.8
395+
Added support for ``mode='func_type'``.
396+
390397
.. versionchanged:: 3.12
391398
:exc:`SyntaxError` is raised instead of :exc:`ValueError` when null bytes
392399
are encountered in *source*.

‎Doc/c-api/call.rst‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -81,17 +81,17 @@ This is a pointer to a function with the following signature:
8181
8282
- *callable* is the object being called.
8383
- *args* is a C array consisting of the positional arguments followed by the
84-
values of the keyword arguments.
85-
This can be *NULL* if there are no arguments.
84+
values of the keyword arguments.
85+
This can be *NULL* if there are no arguments.
8686
- *nargsf* is the number of positional arguments plus possibly the
87-
:c:macro:`PY_VECTORCALL_ARGUMENTS_OFFSET` flag.
88-
To get the actual number of positional arguments from *nargsf*,
89-
use :c:func:`PyVectorcall_NARGS`.
87+
:c:macro:`PY_VECTORCALL_ARGUMENTS_OFFSET` flag.
88+
To get the actual number of positional arguments from *nargsf*,
89+
use :c:func:`PyVectorcall_NARGS`.
9090
- *kwnames* is a tuple containing the names of the keyword arguments;
91-
in other words, the keys of the kwargs dict.
92-
These names must be strings (instances of ``str`` or a subclass)
93-
and they must be unique.
94-
If there are no keyword arguments, then *kwnames* can instead be *NULL*.
91+
in other words, the keys of the kwargs dict.
92+
These names must be strings (instances of ``str`` or a subclass)
93+
and they must be unique.
94+
If there are no keyword arguments, then *kwnames* can instead be *NULL*.
9595

9696
.. c:macro:: PY_VECTORCALL_ARGUMENTS_OFFSET
9797

‎Doc/c-api/code.rst‎

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,12 @@ bound into a function.
9494
9595
.. c:function:: int PyCode_Addr2Line(PyCodeObject *co, int byte_offset)
9696
97-
Return the line number of the instruction that occurs on or before ``byte_offset`` and ends after it.
98-
If you just need the line number of a frame, use :c:func:`PyFrame_GetLineNumber` instead.
97+
Return the line number of the instruction that occurs on or before
98+
``byte_offset`` and ends after it. This may be ``O(N)`` in the number of
99+
instructions in the code object, so it is not performant for iterating over
100+
all the line numbers in a code object.
99101
100-
For efficiently iterating over the line numbers in a code object, use :pep:`the API described in PEP 626
101-
<0626#out-of-process-debuggers-and-profilers>`.
102+
If you just need the line number of a frame, use :c:func:`PyFrame_GetLineNumber` instead.
102103
103104
.. c:function:: int PyCode_Addr2Location(PyObject *co, int byte_offset, int *start_line, int *start_column, int *end_line, int *end_column)
104105
@@ -176,6 +177,14 @@ bound into a function.
176177
177178
.. versionadded:: 3.12
178179
180+
.. c:macro:: PY_FOREACH_CODE_EVENT(V)
181+
182+
Apply the macro *V* to each suffix of :c:type:`PyCodeEvent`
183+
constants.
184+
Currently expands to ``V(CREATE) V(DESTROY)``.
185+
The macro *V* must accept one event name and supply any punctuation
186+
needed between expansions.
187+
179188
.. c:type:: int (*PyCode_WatchCallback)(PyCodeEvent event, PyCodeObject* co)
180189
181190
Type of a code object watcher callback function.

‎Doc/c-api/conversion.rst‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,3 +258,23 @@ The argument must be a signed or unsigned :c:expr:`char`.
258258
.. c:macro:: Py_TOUPPER(c)
259259
260260
Return the uppercase equivalent of the character *c*.
261+
262+
263+
Bit masks
264+
---------
265+
266+
The following constants are bit masks used by the character classification
267+
macros above:
268+
269+
.. c:macro:: PY_CTF_ALNUM
270+
PY_CTF_ALPHA
271+
PY_CTF_DIGIT
272+
PY_CTF_LOWER
273+
PY_CTF_SPACE
274+
PY_CTF_UPPER
275+
PY_CTF_XDIGIT
276+
277+
Values used internally by the ``Py_IS*`` classification macros above.
278+
Exposed for backwards compatibility only.
279+
280+
.. soft-deprecated:: 3.15.2

‎Doc/c-api/descriptor.rst‎

Lines changed: 42 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -72,38 +72,34 @@ found in the dictionary of type objects.
7272
methods on a type, and correspond to :class:`types.MethodDescriptorType`
7373
objects in Python.
7474
75+
.. c:var:: PyTypeObject PyWrapperDescr_Type
7576
76-
.. c:struct:: wrapperbase
77+
The type object for wrapper descriptor objects created by
78+
:c:func:`PyDescr_NewWrapper` and :c:func:`PyWrapper_New`.
7779
78-
Describes a slot wrapper used by :c:func:`PyDescr_NewWrapper`.
80+
Wrapper descriptors are used internally to expose special methods
81+
such as ``__repr__`` or ``__add__``, which are implemented by type slots.
82+
The type is exposed in Python as :class:`types.WrapperDescriptorType`.
7983
80-
Each ``wrapperbase`` record stores the Python-visible name and metadata for a
81-
special method implemented by a type slot, together with the wrapper
82-
function used to adapt that slot to Python's calling convention.
8384
84-
.. c:function:: PyObject* PyDescr_NewWrapper(PyTypeObject *type, struct wrapperbase *base, void *wrapped)
85+
.. `wrapperbase` & `PyWrapperFlag_KEYWORDS` show up in search and index,
86+
and link here, but are only referenced in prose:
8587
86-
Create a new wrapper descriptor for extension type *type* from the
87-
:c:struct:`wrapperbase` structure *base* and the wrapped slot function
88-
pointer
89-
*wrapped*.
88+
.. c:struct:: wrapperbase
89+
:no-typesetting:
9090
91-
Wrapper descriptors expose special methods implemented by type slots. This
92-
is the same kind of descriptor that CPython creates for slot-based special
93-
methods such as ``__repr__`` or ``__add__``, and it appears in Python as a
94-
:class:`types.WrapperDescriptorType` object.
91+
.. c:macro:: PyWrapperFlag_KEYWORDS
92+
:no-typesetting:
9593
96-
On success, return a :term:`strong reference` to the descriptor. Return
97-
``NULL`` with an exception set on failure.
94+
.. c:function:: PyObject* PyDescr_NewWrapper(PyTypeObject *type, struct wrapperbase *base, void *wrapped)
9895
99-
.. c:var:: PyTypeObject PyWrapperDescr_Type
96+
Create a new wrapper descriptor of type :c:var:`PyWrapperDescr_Type`.
10097
101-
The type object for wrapper descriptor objects created by
102-
:c:func:`PyDescr_NewWrapper` and :c:func:`PyWrapper_New`. Wrapper
103-
descriptors are used internally to expose special methods implemented
104-
via wrapper structures, and appear in Python as
105-
:class:`types.WrapperDescriptorType` objects.
98+
This function is meant for internal use only; it and
99+
related API (``struct wrapperbase`` and the ``PyWrapperFlag_KEYWORDS``
100+
flag) are exposed publicly for backwards compatibility reasons.
106101
102+
See :c:func:`PyCMethod_New` for wrapping a C function.
107103
108104
.. c:function:: PyObject* PyDescr_NewClassMethod(PyTypeObject *type, PyMethodDef *method)
109105
@@ -138,6 +134,30 @@ found in the dictionary of type objects.
138134
On success, return a :term:`strong reference` to the wrapper object. Return
139135
``NULL`` with an exception set on failure.
140136
137+
.. c:macro:: PyDescr_TYPE(descr)
138+
139+
Return a :term:`borrowed reference` to the type that the descriptor
140+
*descr* belongs to. This is accessible as :attr:`~object.__objclass__`
141+
in Python.
142+
143+
*descr* must be a descriptor object created by one of the
144+
``PyDescr_New*`` functions (an instance of
145+
:c:var:`PyMethodDescr_Type`, :c:var:`PyClassMethodDescr_Type`,
146+
:c:var:`PyMemberDescr_Type`, :c:var:`PyGetSetDescr_Type`, or
147+
:c:var:`PyWrapperDescr_Type`). If the passed descriptor is not
148+
an instance of one of these types, the behavior is undefined.
149+
150+
151+
.. c:macro:: PyDescr_NAME(descr)
152+
153+
Return the name of the descriptor *descr* as a :term:`borrowed reference`
154+
to a :class:`str` object. This is available as :attr:`~definition.__name__`
155+
in Python.
156+
157+
*descr* must be a descriptor object created by one of the ``PyDescr_New*``
158+
functions. If not, the behavior is undefined.
159+
160+
141161
.. c:macro:: PyDescr_COMMON
142162
143163
This is a macro including the common fields for a

0 commit comments

Comments
 (0)