Skip to content

Commit b30c9f4

Browse files
authored
Merge branch 'main' into complex-realimag-asdouble
2 parents 9af6e86 + ce298a1 commit b30c9f4

File tree

822 files changed

+17167
-12217
lines changed

Some content is hidden

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

822 files changed

+17167
-12217
lines changed

.editorconfig

+3
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,8 @@ indent_style = space
88
[*.{py,c,cpp,h}]
99
indent_size = 4
1010

11+
[*.rst]
12+
indent_size = 3
13+
1114
[*.yml]
1215
indent_size = 2

.pre-commit-config.yaml

+2-11
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,11 @@ repos:
2323
- id: trailing-whitespace
2424
types_or: [c, inc, python, rst]
2525

26-
- repo: local
27-
hooks:
28-
- id: python-file-whitespace
29-
name: "Check Python file whitespace"
30-
entry: 'python Tools/patchcheck/reindent.py --nobackup --newline LF'
31-
language: 'system'
32-
types: [python]
33-
exclude: '^(Lib/test/tokenizedata/|Tools/c-analyzer/cpython/_parser).*$'
34-
3526
- repo: https://github.com/sphinx-contrib/sphinx-lint
36-
rev: v0.6.8
27+
rev: v0.7.0
3728
hooks:
3829
- id: sphinx-lint
39-
args: [--enable=default-role]
30+
args: [--enable=default-role, -j1]
4031
files: ^Doc/|^Misc/NEWS.d/next/
4132
types: [rst]
4233

Doc/c-api/memory.rst

+12-12
Original file line numberDiff line numberDiff line change
@@ -491,18 +491,18 @@ Customize Memory Allocators
491491
492492
:c:func:`PyMem_SetAllocator` does have the following contract:
493493
494-
* It can be called after :c:func:`Py_PreInitialize` and before
495-
:c:func:`Py_InitializeFromConfig` to install a custom memory
496-
allocator. There are no restrictions over the installed allocator
497-
other than the ones imposed by the domain (for instance, the Raw
498-
Domain allows the allocator to be called without the GIL held). See
499-
:ref:`the section on allocator domains <allocator-domains>` for more
500-
information.
501-
502-
* If called after Python has finish initializing (after
503-
:c:func:`Py_InitializeFromConfig` has been called) the allocator
504-
**must** wrap the existing allocator. Substituting the current
505-
allocator for some other arbitrary one is **not supported**.
494+
* It can be called after :c:func:`Py_PreInitialize` and before
495+
:c:func:`Py_InitializeFromConfig` to install a custom memory
496+
allocator. There are no restrictions over the installed allocator
497+
other than the ones imposed by the domain (for instance, the Raw
498+
Domain allows the allocator to be called without the GIL held). See
499+
:ref:`the section on allocator domains <allocator-domains>` for more
500+
information.
501+
502+
* If called after Python has finish initializing (after
503+
:c:func:`Py_InitializeFromConfig` has been called) the allocator
504+
**must** wrap the existing allocator. Substituting the current
505+
allocator for some other arbitrary one is **not supported**.
506506
507507
.. versionchanged:: 3.12
508508
All allocators must be thread-safe.

Doc/c-api/structures.rst

+5-1
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,11 @@ Accessing attributes of extension types
406406
.. c:type:: PyMemberDef
407407
408408
Structure which describes an attribute of a type which corresponds to a C
409-
struct member. Its fields are, in order:
409+
struct member.
410+
When defining a class, put a NULL-terminated array of these
411+
structures in the :c:member:`~PyTypeObject.tp_members` slot.
412+
413+
Its fields are, in order:
410414
411415
.. c:member:: const char* name
412416

Doc/c-api/type.rst

+27-14
Original file line numberDiff line numberDiff line change
@@ -461,21 +461,34 @@ The following functions and structs are used to create
461461
* ``Py_nb_add`` to set :c:member:`PyNumberMethods.nb_add`
462462
* ``Py_sq_length`` to set :c:member:`PySequenceMethods.sq_length`
463463
464-
The following fields cannot be set at all using :c:type:`PyType_Spec` and
465-
:c:type:`PyType_Slot`:
466-
467-
* :c:member:`~PyTypeObject.tp_dict`
468-
* :c:member:`~PyTypeObject.tp_mro`
469-
* :c:member:`~PyTypeObject.tp_cache`
470-
* :c:member:`~PyTypeObject.tp_subclasses`
471-
* :c:member:`~PyTypeObject.tp_weaklist`
464+
The following “offset” fields cannot be set using :c:type:`PyType_Slot`:
465+
466+
* :c:member:`~PyTypeObject.tp_weaklistoffset`
467+
(use :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` instead if possible)
468+
* :c:member:`~PyTypeObject.tp_dictoffset`
469+
(use :c:macro:`Py_TPFLAGS_MANAGED_DICT` instead if possible)
470+
* :c:member:`~PyTypeObject.tp_vectorcall_offset`
471+
(use ``"__vectorcalloffset__"`` in
472+
:ref:`PyMemberDef <pymemberdef-offsets>`)
473+
474+
If it is not possible to switch to a ``MANAGED`` flag (for example,
475+
for vectorcall or to support Python older than 3.12), specify the
476+
offset in :c:member:`Py_tp_members <PyTypeObject.tp_members>`.
477+
See :ref:`PyMemberDef documentation <pymemberdef-offsets>`
478+
for details.
479+
480+
The following fields cannot be set at all when creating a heap type:
481+
472482
* :c:member:`~PyTypeObject.tp_vectorcall`
473-
* :c:member:`~PyTypeObject.tp_weaklistoffset`
474-
(use :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` instead)
475-
* :c:member:`~PyTypeObject.tp_dictoffset`
476-
(use :c:macro:`Py_TPFLAGS_MANAGED_DICT` instead)
477-
* :c:member:`~PyTypeObject.tp_vectorcall_offset`
478-
(see :ref:`PyMemberDef <pymemberdef-offsets>`)
483+
(use :c:member:`~PyTypeObject.tp_new` and/or
484+
:c:member:`~PyTypeObject.tp_init`)
485+
486+
* Internal fields:
487+
:c:member:`~PyTypeObject.tp_dict`,
488+
:c:member:`~PyTypeObject.tp_mro`,
489+
:c:member:`~PyTypeObject.tp_cache`,
490+
:c:member:`~PyTypeObject.tp_subclasses`, and
491+
:c:member:`~PyTypeObject.tp_weaklist`.
479492
480493
Setting :c:data:`Py_tp_bases` or :c:data:`Py_tp_base` may be
481494
problematic on some platforms.

Doc/c-api/unicode.rst

+22
Original file line numberDiff line numberDiff line change
@@ -1396,6 +1396,28 @@ They all return ``NULL`` or ``-1`` if an exception occurs.
13961396
:c:func:`PyErr_Occurred` to check for errors.
13971397
13981398
1399+
.. c:function:: int PyUnicode_EqualToUTF8AndSize(PyObject *unicode, const char *string, Py_ssize_t size)
1400+
1401+
Compare a Unicode object with a char buffer which is interpreted as
1402+
being UTF-8 or ASCII encoded and return true (``1``) if they are equal,
1403+
or false (``0``) otherwise.
1404+
If the Unicode object contains surrogate characters or
1405+
the C string is not valid UTF-8, false (``0``) is returned.
1406+
1407+
This function does not raise exceptions.
1408+
1409+
.. versionadded:: 3.13
1410+
1411+
1412+
.. c:function:: int PyUnicode_EqualToUTF8(PyObject *unicode, const char *string)
1413+
1414+
Similar to :c:func:`PyUnicode_EqualToUTF8AndSize`, but compute *string*
1415+
length using :c:func:`!strlen`.
1416+
If the Unicode object contains null characters, false (``0``) is returned.
1417+
1418+
.. versionadded:: 3.13
1419+
1420+
13991421
.. c:function:: int PyUnicode_CompareWithASCIIString(PyObject *uni, const char *string)
14001422
14011423
Compare a Unicode object, *uni*, with *string* and return ``-1``, ``0``, ``1`` for less

Doc/data/stable_abi.dat

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)