Skip to content

Commit a6b0670

Browse files
committed
Merge branch 'main' into pegen-include-grammar
2 parents 49985d4 + f9f33a6 commit a6b0670

760 files changed

Lines changed: 28506 additions & 8709 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/VULNERABILITY_REPORT.yml‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,6 @@ body:
5151
- "3.15"
5252
- "3.16"
5353
- "CPython main branch"
54-
validations:
55-
required: true
5654
- type: textarea
5755
id: patch
5856
attributes:

‎.github/workflows/reusable-emscripten.yml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,3 +79,5 @@ jobs:
7979
run: python3 Platforms/emscripten run --test
8080
- name: "Test Repl"
8181
run: Platforms/emscripten/browser_test/run_test.sh
82+
- name: "Test embedding"
83+
run: Platforms/emscripten/web_embed_test/run_test.sh

‎.github/workflows/reusable-wasi.yml‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ jobs:
1616
timeout-minutes: 60
1717
env:
1818
WASMTIME_VERSION: 48.0.2
19-
CROSS_BUILD_WASI: cross-build/wasm32-wasip1
2019
steps:
2120
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
2221
with:
@@ -65,4 +64,6 @@ jobs:
6564
- name: "Display build info of the host/WASI Python"
6665
run: python3 Platforms/WASI pythoninfo-host
6766
- name: "Test"
68-
run: make --directory "${CROSS_BUILD_WASI}" test
67+
run: |
68+
CROSS_BUILD_WASI=$(python3 Platforms/WASI path)
69+
make --directory "${CROSS_BUILD_WASI}" test

‎.gitignore‎

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,16 +72,19 @@ Lib/test/data/*
7272
/_bootstrap_python
7373
/Makefile
7474
/Makefile.pre
75-
/iOSTestbed.*
76-
Apple/iOS/Frameworks/
77-
Apple/iOS/Resources/Info.plist
78-
Apple/testbed/build
75+
/AppleTestbed.*
76+
Platforms/Apple/iOS/Frameworks/*
77+
Platforms/Apple/iOS/Resources/Info.plist
7978
Platforms/Apple/testbed/Python*.xcframework/*/bin
8079
Platforms/Apple/testbed/Python*.xcframework/*/include
8180
Platforms/Apple/testbed/Python*.xcframework/*/lib
8281
Platforms/Apple/testbed/Python*.xcframework/*/Python*.framework
83-
Apple/testbed/*Testbed.xcodeproj/project.xcworkspace
84-
Apple/testbed/*Testbed.xcodeproj/xcuserdata
82+
Platforms/Apple/tvOS/Frameworks/*
83+
Platforms/Apple/tvOS/Resources/Info.plist
84+
Platforms/Apple/visionOS/Frameworks/*
85+
Platforms/Apple/visionOS/Resources/Info.plist
86+
Platforms/Apple/watchOS/Frameworks/*
87+
Platforms/Apple/watchOS/Resources/Info.plist
8588
Mac/Makefile
8689
Mac/PythonLauncher/Info.plist
8790
Mac/PythonLauncher/Makefile
@@ -180,6 +183,7 @@ Python/frozen_modules/MANIFEST
180183

181184
# Local AI agent scratch state (per-PR and per-branch notebooks, sandbox
182185
# experiments) and personal agent overrides, none of which are committed.
186+
/do-not-commit/
183187
/.claude/pr-*
184188
/.claude/branch-*
185189
/.claude/sandbox/

‎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/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:: next

‎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

‎Doc/c-api/dict.rst‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -563,6 +563,15 @@ Dictionary objects
563563
564564
.. versionadded:: 3.12
565565
566+
.. c:macro:: PY_FOREACH_DICT_EVENT(V)
567+
568+
Apply the macro *V* to each suffix of :c:type:`PyDict_WatchEvent`
569+
constants.
570+
Currently expands to ``V(ADDED) V(MODIFIED) V(DELETED) V(CLONED)
571+
V(CLEARED) V(DEALLOCATED)``.
572+
The macro *V* must accept one event name and supply any punctuation
573+
needed between expansions.
574+
566575
.. c:type:: int (*PyDict_WatchCallback)(PyDict_WatchEvent event, PyObject *dict, PyObject *key, PyObject *new_value)
567576
568577
Type of a dict watcher callback function.

0 commit comments

Comments
 (0)