8000 Merge branch 'main' into py-refcnt-add-immortal · python/cpython@1471b39 · GitHub
[go: up one dir, main page]

Skip to content

Commit 1471b39

Browse files
Merge branch 'main' into py-refcnt-add-immortal
2 parents be3b103 + f5c3838 commit 1471b39

File tree

146 files changed

+3402
-635
lines changed
  • _testcapi
  • Objects
  • PC
  • PCbuild
  • Parser
  • Python
  • Tools
  • Some content is hidden

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

    146 files changed

    +3402
    -635
    lines changed

    Doc/c-api/bytearray.rst

    +1-1
    Original file line numberDiff line numberDiff line change
    @@ -5,7 +5,7 @@
    55
    Byte Array Objects
    66
    ------------------
    77

    8-
    .. index:: object: bytearray
    8+
    .. index:: pair: object; bytearray
    99

    1010

    1111
    .. c:type:: PyByteArrayObject

    Doc/c-api/bytes.rst

    +1-1
    Original file line numberDiff line numberDiff line change
    @@ -8,7 +8,7 @@ Bytes Objects
    88
    These functions raise :exc:`TypeError` when expecting a bytes parameter and
    99
    called with a non-bytes parameter.
    1010

    11-
    .. index:: object: bytes
    11+
    .. index:: pair: object; bytes
    1212

    1313

    1414
    .. c:type:: PyBytesObject

    Doc/c-api/capsule.rst

    +1-1
    Original file line numberDiff line numberDiff line change
    @@ -5,7 +5,7 @@
    55
    Capsules
    66
    --------
    77

    8-
    .. index:: object: Capsule
    8+
    .. index:: pair: object; Capsule
    99

    1010
    Refer to :ref:`using-capsules` for more information on using these objects.
    1111

    Doc/c-api/complex.rst

    +1-1
    Original file line numberDiff line numberDiff line change
    @@ -5,7 +5,7 @@
    55
    Complex Number Objects
    66
    ----------------------
    77

    8-
    .. index:: object: complex number
    8+
    .. index:: pair: object; complex number
    99

    1010
    Python's complex number objects are implemented as two distinct types when
    1111
    viewed from the C API: one is the Python object exposed to Python programs, and

    Doc/c-api/concrete.rst

    +3-3
    Original file line numberDiff line numberDiff line change
    @@ -40,7 +40,7 @@ This section describes Python type objects and the singleton object ``None``.
    4040
    Numeric Objects
    4141
    ===============
    4242

    43-
    .. index:: object: numeric
    43+
    .. index:: pair: object; numeric
    4444

    4545
    .. toctree::
    4646

    @@ -55,7 +55,7 @@ Numeric Objects
    5555
    Sequence Objects
    5656
    ================
    5757

    58-
    .. index:: object: sequence
    58+
    .. index:: pair: object; sequence
    5959

    6060
    Generic operations on sequence objects were discussed in the previous chapter;
    6161
    this section deals with the specific kinds of sequence objects that are
    @@ -77,7 +77,7 @@ intrinsic to the Python language.
    7777
    Container Objects
    7878
    =================
    7979

    80-
    .. index:: object: mapping
    80+
    .. index:: pair: object; mapping
    8181

    8282
    .. toctree::
    8383

    Doc/c-api/dict.rst

    +1-1
    Original file line numberDiff line numberDiff line change
    @@ -5,7 +5,7 @@
    55
    Dictionary Objects
    66
    ------------------
    77

    8-
    .. index:: object: dictionary
    8+
    .. index:: pair: object; dictionary
    99

    1010

    1111
    .. c:type:: PyDictObject

    Doc/c-api/exceptions.rst

    +3-3
    Original file line numberDiff line numberDiff line change
    @@ -602,7 +602,7 @@ Signal Handling
    602602
    .. c:function:: int PyErr_CheckSignals()
    603603
    604604
    .. index::
    605-
    module: signal
    605+
    pair: module; signal
    606606
    single: SIGINT
    607607
    single: KeyboardInterrupt (built-in exception)
    608608
    @@ -633,7 +633,7 @@ Signal Handling
    633633
    .. c:function:: void PyErr_SetInterrupt()
    634634
    635635
    .. index::
    636-
    module: signal
    636+
    pair: module; signal
    637637
    single: SIGINT
    638638
    single: KeyboardInterrupt (built-in exception)
    639639
    @@ -648,7 +648,7 @@ Signal Handling
    648648
    .. c:function:: int PyErr_SetInterruptEx(int signum)
    649649
    650650
    .. index::
    651-
    module: signal
    651+
    pair: module; signal
    652652
    single: KeyboardInterrupt (built-in exception)
    653653
    654654
    Simulate the effect of a signal arriving. The next time

    Doc/c-api/file.rst

    +1-1
    Original file line numberDiff line numberDiff line change
    @@ -5,7 +5,7 @@
    55
    File Objects
    66
    ------------
    77

    8-
    .. index:: object: file
    8+
    .. index:: pair: object; file
    99

    1010
    These APIs are a minimal emulation of the Python 2 C API for built-in file
    1111
    objects, which used to rely on the buffered I/O (:c:expr:`FILE*`) support

    Doc/c-api/float.rst

    +1-1
    Original file line numberDiff line numberDiff line change
    @@ -5,7 +5,7 @@
    55
    Floating Point Objects
    66
    ----------------------
    77

    8-
    .. index:: object: floating point
    8+
    .. index:: pair: object; floating point
    99

    1010

    1111
    .. c:type:: PyFloatObject

    Doc/c-api/function.rst

    +1-1
    Original file line numberDiff line numberDiff line change
    @@ -5,7 +5,7 @@
    55
    Function Objects
    66
    ----------------
    77

    8-
    .. index:: object: function
    8+
    .. index:: pair: object; function
    99

    1010
    There are a few functions specific to Python functions.
    1111

    Doc/c-api/init.rst

    +7-7
    Original file line numberDiff line numberDiff line change
    @@ -336,9 +336,9 @@ Initializing and finalizing the interpreter
    336336
    single: PyEval_InitThreads()
    337337
    single: modules (in module sys)
    338338
    single: path (in module sys)
    339-
    module: builtins
    340-
    module: __main__
    341-
    module: sys
    339+
    pair: module; builtins
    340+
    pair: module; __main__
    341+
    pair: module; sys
    342342
    triple: module; search; path
    343343
    single: PySys_SetArgv()
    344344
    single: PySys_SetArgvEx()
    @@ -1051,7 +1051,7 @@ code, or when embedding the Python interpreter:
    10511051
    10521052
    .. deprecated:: 3.9
    10531053
    1054-
    .. index:: module: _thread
    1054+
    .. index:: pair: module; _thread
    10551055
    10561056
    10571057
    .. c:function:: int PyEval_ThreadsInitialized()
    @@ -1494,9 +1494,9 @@ function. You can create and destroy them using the following functions:
    14941494
    .. c:function:: PyThreadState* Py_NewInterpreter()
    14951495
    14961496
    .. index::
    1497-
    module: builtins
    1498-
    module: __main__
    1499-
    module: sys
    1497+
    pair: module; builtins
    1498+
    pair: module; __main__
    1499+
    pair: module; sys
    15001500
    single: stdout (in module sys)
    15011501
    single: stderr (in module sys)
    15021502
    single: stdin (in module sys)

    Doc/c-api/intro.rst

    +4-4
    Original file line numberDiff line numberDiff line change
    @@ -261,7 +261,7 @@ complete listing.
    261261
    Objects, Types and Reference Counts
    262262
    ===================================
    263263

    264-
    .. index:: object: type
    264+
    .. index:: pair: object; type
    265265

    266266
    Most Python/C API functions have one or more arguments as well as a return value
    267267
    of type :c:expr:`PyObject*`. This type is a pointer to an opaque data type
    @@ -705,9 +705,9 @@ interpreter can only be used after the interpreter has been initialized.
    705705

    706706
    .. index::
    707707
    single: Py_Initialize()
    708-
    module: builtins
    709-
    module: __main__
    710-
    module: sys
    708+
    pair: module; builtins
    709+
    pair: module; __main__
    710+
    pair: module; sys
    711711
    triple: module; search; path
    712712
    single: path (in module sys)
    713713

    Doc/c-api/list.rst

    +1-1
    Original file line numberDiff line numberDiff line change
    @@ -5,7 +5,7 @@
    55
    List Objects
    66
    ------------
    77

    8-
    .. index:: object: list
    8+
    .. index:: pair: object; list
    99

    1010

    1111
    .. c:type:: PyListObject

    Doc/c-api/long.rst

    +2-2
    Original file line numberDiff line numberDiff line change
    @@ -5,8 +5,8 @@
    55
    Integer Objects
    66
    ---------------
    77

    8-
    .. index:: object: long integer
    9-
    object: integer
    8+
    .. index:: pair: object; long integer
    9+
    pair: object; integer
    1010

    1111
    All integers are implemented as "long" integer objects of arbitrary size.
    1212

    Doc/c-api/memoryview.rst

    +1-1
    Original file line numberDiff line numberDiff line change
    @@ -3,7 +3,7 @@
    33
    .. _memoryview-objects:
    44

    55
    .. index::
    6-
    object: memoryview
    6+
    pair: object; memoryview
    77

    88
    MemoryView objects
    99
    ------------------

    Doc/c-api/method.rst

    +2-2
    Original file line numberDiff line numberDiff line change
    @@ -5,7 +5,7 @@
    55
    Instance Method Objects
    66
    -----------------------
    77

    8-
    .. index:: object: instancemethod
    8+
    .. index:: pair: object; instancemethod
    99

    1010
    An instance method is a wrapper for a :c:data:`PyCFunction` and the new way
    1111
    to bind a :c:data:`PyCFunction` to a class object. It replaces the former call
    @@ -47,7 +47,7 @@ to bind a :c:data:`PyCFunction` to a class object. It replaces the former call
    4747
    Method Objects
    4848
    --------------
    4949
    50-
    .. index:: object: method
    50+
    .. index:: pair: object; method
    5151
    5252
    Methods are bound function objects. Methods are always bound to an instance of
    5353
    a user-defined class. Unbound methods (methods bound to a class object) are

    Doc/c-api/module.rst

    +1-1
    Original file line numberDiff line numberDiff line change
    @@ -5,7 +5,7 @@
    55
    Module Objects
    66
    --------------
    77

    8-
    .. index:: object: module
    8+
    .. index:: pair: object; module
    99

    1010

    1111
    .. c:var:: PyTypeObject PyModule_Type

    Doc/c-api/none.rst

    +1-1
    Original file line numberDiff line numberDiff line change
    @@ -5,7 +5,7 @@
    55
    The ``None`` Object
    66
    -------------------
    77

    8-
    .. index:: object: None
    8+
    .. index:: pair: object; None
    99

    1010
    Note that the :c:type:`PyTypeObject` for ``None`` is not directly exposed in the
    1111
    Python/C API. Since ``None`` is a singleton, testing for object identity (using

    Doc/c-api/object.rst

    +39
    Original file line numberDiff line numberDiff line change
    @@ -395,3 +395,42 @@ Object Protocol
    395395
    returns ``NULL`` if the object cannot be iterated.
    396396
    397397
    .. versionadded:: 3.10
    398+
    399+
    .. c:function:: void *PyObject_GetTypeData(PyObject *o, PyTypeObject *cls)
    400+
    401+
    Get a pointer to subclass-specific data reserved for *cls*.
    402+
    403+
    The object *o* must be an instance of *cls*, and *cls* must have been
    404+
    created using negative :c:member:`PyType_Spec.basicsize`.
    405+
    Python does not check this.
    406+
    407+
    On error, set an exception and return ``NULL``.
    408+
    409+
    .. versionadded:: 3.12
    410+
    411+
    .. c:function:: Py_ssize_t PyType_GetTypeDataSize(PyTypeObject *cls)
    412+
    413+
    Return the size of the instance memory space reserved for *cls*, i.e. the size of the
    414+
    memory :c:func:`PyObject_GetTypeData` returns.
    415+
    416+
    This may be larger than requested using :c:member:`-PyType_Spec.basicsize <PyType_Spec.basicsize>`;
    417+
    it is safe to use this larger size (e.g. with :c:func:`!memset`).
    418+
    419+
    The type *cls* **must** have been created using
    420+
    negative :c:member:`PyType_Spec.basicsize`.
    421+
    Python does not check this.
    422+
    423+
    On error, set an exception and return a negative value.
    424+
    425+
    .. versionadded:: 3.12
    426+
    427+
    .. c:function:: void *PyObject_GetItemData(PyObject *o)
    428+
    429+
    Get a pointer to per-item data for a class with
    430+
    :const:`Py_TPFLAGS_ITEMS_AT_END`.
    431+
    432+
    On error, set an exception and return ``NULL``.
    433+
    :py:exc:`TypeError` is raised if *o* does not have
    434+
    :const:`Py_TPFLAGS_ITEMS_AT_END` set.
    435+
    436+
    .. versionadded:: 3.12

    Doc/c-api/set.rst

    +2-2
    Original file line numberDiff line numberDiff line change
    @@ -9,8 +9,8 @@ Set Objects
    99

    1010

    1111
    .. index::
    12-
    object: set
    13-
    object: frozenset
    12+
    pair: object; set
    13+
    pair: object; frozenset
    1414

    1515
    This section details the public API for :class:`set` and :class:`frozenset`
    1616
    objects. Any functionality not listed below is best accessed using either

    Doc/c-api/structures.rst

    +16
    Original file line numberDiff line numberDiff line change
    @@ -486,6 +486,22 @@ The following flags can be used with :c:member:`PyMemberDef.flags`:
    486486
    Emit an ``object.__getattr__`` :ref:`audit event <audit-events>`
    487487
    before reading.
    488488
    489+
    .. c:macro:: Py_RELATIVE_OFFSET
    490+
    491+
    Indicates that the :c:member:`~PyMemberDef.offset` of this ``PyMemberDef``
    492+
    entry indicates an offset from the subclass-specific data, rather than
    493+
    from ``PyObject``.
    494+
    495+
    Can only be used as part of :c:member:`Py_tp_members <PyTypeObject.tp_members>`
    496+
    :c:type:`slot <PyTypeSlot>` when creating a class using negative
    497+
    :c:member:`~PyTypeDef.basicsize`.
    498+
    It is mandatory in that case.
    499+
    500+
    This flag is only used in :c:type:`PyTypeSlot`.
    501+
    When setting :c:member:`~PyTypeObject.tp_members` during
    502+
    class creation, Python clears it and sets
    503+
    :c:member:`PyMemberDef.offset` to the offset from the ``PyObject`` struct.
    504+
    489505
    .. index::
    490506
    single: READ_RESTRICTED
    491507
    single: WRITE_RESTRICTED

    Doc/c-api/tuple.rst

    +1-1
    Original file line numberDiff line numberDiff line change
    @@ -5,7 +5,7 @@
    55
    Tuple Objects
    66
    -------------
    77

    8-
    .. index:: object: tuple
    8+
    .. index:: pair: object; tuple
    99

    1010

    1111
    .. c:type:: PyTupleObject

    0 commit comments

    Comments
     (0)
    0