Skip to content

Commit 9098035

Browse files
authored
Merge branch 'main' into feature/filecmp-coverage
2 parents 7e44c1f + d0212f6 commit 9098035

277 files changed

Lines changed: 15757 additions & 5514 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.

‎.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ Python/frozen_modules/MANIFEST
180180

181181
# Local AI agent scratch state (per-PR and per-branch notebooks, sandbox
182182
# experiments) and personal agent overrides, none of which are committed.
183+
/do-not-commit/
183184
/.claude/pr-*
184185
/.claude/branch-*
185186
/.claude/sandbox/

‎Doc/c-api/code.rst‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,14 @@ bound into a function.
176176
177177
.. versionadded:: 3.12
178178
179+
.. c:macro:: PY_FOREACH_CODE_EVENT(V)
180+
181+
Apply the macro *V* to each suffix of :c:type:`PyCodeEvent`
182+
constants.
183+
Currently expands to ``V(CREATE) V(DESTROY)``.
184+
The macro *V* must accept one event name and supply any punctuation
185+
needed between expansions.
186+
179187
.. c:type:: int (*PyCode_WatchCallback)(PyCodeEvent event, PyCodeObject* co)
180188
181189
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)