Skip to content

Commit 2d5238b

Browse files
committed
Link references to type slots
1 parent d890aba commit 2d5238b

File tree

4 files changed

+13
-15
lines changed

4 files changed

+13
-15
lines changed

Doc/c-api/structures.rst

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -605,14 +605,12 @@ The following flags can be used with :c:member:`PyMemberDef.flags`:
605605
entry indicates an offset from the subclass-specific data, rather than
606606
from ``PyObject``.
607607
608-
Can only be used as part of :c:member:`Py_tp_members <PyTypeObject.tp_members>`
608+
Can only be used as part of the :c:data:`Py_tp_members`
609609
:c:type:`slot <PyType_Slot>` when creating a class using negative
610610
:c:member:`~PyType_Spec.basicsize`.
611611
It is mandatory in that case.
612-
613-
This flag is only used in :c:type:`PyType_Slot`.
614-
When setting :c:member:`~PyTypeObject.tp_members` during
615-
class creation, Python clears it and sets
612+
When setting :c:member:`~PyTypeObject.tp_members` from the slot during
613+
class creation, Python clears the flag and sets
616614
:c:member:`PyMemberDef.offset` to the offset from the ``PyObject`` struct.
617615
618616
.. index::

Doc/c-api/type.rst

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -348,8 +348,8 @@ The following functions and structs are used to create
348348
349349
The *bases* argument can be used to specify base classes; it can either
350350
be only one class or a tuple of classes.
351-
If *bases* is ``NULL``, the *Py_tp_bases* slot is used instead.
352-
If that also is ``NULL``, the *Py_tp_base* slot is used instead.
351+
If *bases* is ``NULL``, the :c:data:`Py_tp_bases` slot is used instead.
352+
If that also is ``NULL``, the :c:data:`Py_tp_base` slot is used instead.
353353
If that also is ``NULL``, the new type derives from :class:`object`.
354354
355355
The *module* argument can be used to record the module in which the new
@@ -551,9 +551,9 @@ The following functions and structs are used to create
551551
:c:type:`PyAsyncMethods` with an added ``Py_`` prefix.
552552
For example, use:
553553
554-
* ``Py_tp_dealloc`` to set :c:member:`PyTypeObject.tp_dealloc`
555-
* ``Py_nb_add`` to set :c:member:`PyNumberMethods.nb_add`
556-
* ``Py_sq_length`` to set :c:member:`PySequenceMethods.sq_length`
554+
* :c:data:`Py_tp_dealloc` to set :c:member:`PyTypeObject.tp_dealloc`
555+
* :c:data:`Py_nb_add` to set :c:member:`PyNumberMethods.nb_add`
556+
* :c:data:`Py_sq_length` to set :c:member:`PySequenceMethods.sq_length`
557557
558558
An additional slot is supported that does not correspond to a
559559
:c:type:`!PyTypeObject` struct field:
@@ -572,7 +572,7 @@ The following functions and structs are used to create
572572
573573
If it is not possible to switch to a ``MANAGED`` flag (for example,
574574
for vectorcall or to support Python older than 3.12), specify the
575-
offset in :c:member:`Py_tp_members <PyTypeObject.tp_members>`.
575+
offset in :c:data:`Py_tp_members`.
576576
See :ref:`PyMemberDef documentation <pymemberdef-offsets>`
577577
for details.
578578
@@ -600,7 +600,7 @@ The following functions and structs are used to create
600600
601601
.. versionchanged:: 3.14
602602
The field :c:member:`~PyTypeObject.tp_vectorcall` can now set
603-
using ``Py_tp_vectorcall``. See the field's documentation
603+
using :c:data:`Py_tp_vectorcall`. See the field's documentation
604604
for details.
605605
606606
.. c:member:: void *pfunc
@@ -610,7 +610,7 @@ The following functions and structs are used to create
610610
611611
*pfunc* values may not be ``NULL``, except for the following slots:
612612
613-
* ``Py_tp_doc``
613+
* :c:data:`Py_tp_doc`
614614
* :c:data:`Py_tp_token` (for clarity, prefer :c:data:`Py_TP_USE_SPEC`
615615
rather than ``NULL``)
616616

Doc/c-api/typeobj.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2273,7 +2273,7 @@ and :c:data:`PyType_Type` effectively act as defaults.)
22732273
This field should be set to ``NULL`` and treated as read-only.
22742274
Python will fill it in when the type is :c:func:`initialized <PyType_Ready>`.
22752275

2276-
For dynamically created classes, the ``Py_tp_bases``
2276+
For dynamically created classes, the :c:data:`Py_tp_bases`
22772277
:c:type:`slot <PyType_Slot>` can be used instead of the *bases* argument
22782278
of :c:func:`PyType_FromSpecWithBases`.
22792279
The argument form is preferred.

Doc/howto/isolating-extensions.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ garbage collection protocol.
353353
That is, heap types should:
354354

355355
- Have the :c:macro:`Py_TPFLAGS_HAVE_GC` flag.
356-
- Define a traverse function using ``Py_tp_traverse``, which
356+
- Define a traverse function using :c:data:`Py_tp_traverse`, which
357357
visits the type (e.g. using ``Py_VISIT(Py_TYPE(self))``).
358358

359359
Please refer to the documentation of

0 commit comments

Comments
 (0)