Skip to content

Commit 39668f5

Browse files
committed
Issue python#18589: fix hyperlinking of type slots (tp_*)
1 parent b3c8724 commit 39668f5

File tree

9 files changed

+192
-192
lines changed

9 files changed

+192
-192
lines changed

Doc/c-api/allocation.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Allocating Objects on the Heap
3232
Allocate a new Python object using the C structure type *TYPE* and the
3333
Python type object *type*. Fields not defined by the Python object header
3434
are not initialized; the object's reference count will be one. The size of
35-
the memory allocation is determined from the :attr:`tp_basicsize` field of
35+
the memory allocation is determined from the :c:member:`~PyTypeObject.tp_basicsize` field of
3636
the type object.
3737
3838
@@ -41,7 +41,7 @@ Allocating Objects on the Heap
4141
Allocate a new Python object using the C structure type *TYPE* and the
4242
Python type object *type*. Fields not defined by the Python object header
4343
are not initialized. The allocated memory allows for the *TYPE* structure
44-
plus *size* fields of the size given by the :attr:`tp_itemsize` field of
44+
plus *size* fields of the size given by the :c:member:`~PyTypeObject.tp_itemsize` field of
4545
*type*. This is useful for implementing objects like tuples, which are
4646
able to determine their size at construction time. Embedding the array of
4747
fields into the same allocation decreases the number of allocations,
@@ -52,7 +52,7 @@ Allocating Objects on the Heap
5252
5353
Releases memory allocated to an object using :c:func:`PyObject_New` or
5454
:c:func:`PyObject_NewVar`. This is normally called from the
55-
:attr:`tp_dealloc` handler specified in the object's type. The fields of
55+
:c:member:`~PyTypeObject.tp_dealloc` handler specified in the object's type. The fields of
5656
the object should not be accessed after this call as the memory is no
5757
longer a valid Python object.
5858

Doc/c-api/exceptions.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -607,28 +607,28 @@ recursion depth automatically).
607607
Ends a :c:func:`Py_EnterRecursiveCall`. Must be called once for each
608608
*successful* invocation of :c:func:`Py_EnterRecursiveCall`.
609609
610-
Properly implementing :attr:`tp_repr` for container types requires
610+
Properly implementing :c:member:`~PyTypeObject.tp_repr` for container types requires
611611
special recursion handling. In addition to protecting the stack,
612-
:attr:`tp_repr` also needs to track objects to prevent cycles. The
612+
:c:member:`~PyTypeObject.tp_repr` also needs to track objects to prevent cycles. The
613613
following two functions facilitate this functionality. Effectively,
614614
these are the C equivalent to :func:`reprlib.recursive_repr`.
615615
616616
.. c:function:: int Py_ReprEnter(PyObject *object)
617617
618-
Called at the beginning of the :attr:`tp_repr` implementation to
618+
Called at the beginning of the :c:member:`~PyTypeObject.tp_repr` implementation to
619619
detect cycles.
620620
621621
If the object has already been processed, the function returns a
622-
positive integer. In that case the :attr:`tp_repr` implementation
622+
positive integer. In that case the :c:member:`~PyTypeObject.tp_repr` implementation
623623
should return a string object indicating a cycle. As examples,
624624
:class:`dict` objects return ``{...}`` and :class:`list` objects
625625
return ``[...]``.
626626
627627
The function will return a negative integer if the recursion limit
628-
is reached. In that case the :attr:`tp_repr` implementation should
628+
is reached. In that case the :c:member:`~PyTypeObject.tp_repr` implementation should
629629
typically return ``NULL``.
630630
631-
Otherwise, the function returns zero and the :attr:`tp_repr`
631+
Otherwise, the function returns zero and the :c:member:`~PyTypeObject.tp_repr`
632632
implementation can continue normally.
633633
634634
.. c:function:: void Py_ReprLeave(PyObject *object)

Doc/c-api/gcsupport.rst

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ other objects, or which only store references to atomic types (such as numbers
1212
or strings), do not need to provide any explicit support for garbage
1313
collection.
1414

15-
To create a container type, the :attr:`tp_flags` field of the type object must
15+
To create a container type, the :c:member:`~PyTypeObject.tp_flags` field of the type object must
1616
include the :const:`Py_TPFLAGS_HAVE_GC` and provide an implementation of the
17-
:attr:`tp_traverse` handler. If instances of the type are mutable, a
18-
:attr:`tp_clear` implementation must also be provided.
17+
:c:member:`~PyTypeObject.tp_traverse` handler. If instances of the type are mutable, a
18+
:c:member:`~PyTypeObject.tp_clear` implementation must also be provided.
1919

2020

2121
.. data:: Py_TPFLAGS_HAVE_GC
@@ -57,7 +57,7 @@ Constructors for container types must conform to two rules:
5757
Adds the object *op* to the set of container objects tracked by the
5858
collector. The collector can run at unexpected times so objects must be
5959
valid while being tracked. This should be called once all the fields
60-
followed by the :attr:`tp_traverse` handler become valid, usually near the
60+
followed by the :c:member:`~PyTypeObject.tp_traverse` handler become valid, usually near the
6161
end of the constructor.
6262
6363
@@ -86,28 +86,28 @@ rules:
8686
Remove the object *op* from the set of container objects tracked by the
8787
collector. Note that :c:func:`PyObject_GC_Track` can be called again on
8888
this object to add it back to the set of tracked objects. The deallocator
89-
(:attr:`tp_dealloc` handler) should call this for the object before any of
90-
the fields used by the :attr:`tp_traverse` handler become invalid.
89+
(:c:member:`~PyTypeObject.tp_dealloc` handler) should call this for the object before any of
90+
the fields used by the :c:member:`~PyTypeObject.tp_traverse` handler become invalid.
9191
9292
9393
.. c:function:: void _PyObject_GC_UNTRACK(PyObject *op)
9494
9595
A macro version of :c:func:`PyObject_GC_UnTrack`. It should not be used for
9696
extension modules.
9797
98-
The :attr:`tp_traverse` handler accepts a function parameter of this type:
98+
The :c:member:`~PyTypeObject.tp_traverse` handler accepts a function parameter of this type:
9999
100100
101101
.. c:type:: int (*visitproc)(PyObject *object, void *arg)
102102
103-
Type of the visitor function passed to the :attr:`tp_traverse` handler.
103+
Type of the visitor function passed to the :c:member:`~PyTypeObject.tp_traverse` handler.
104104
The function should be called with an object to traverse as *object* and
105-
the third parameter to the :attr:`tp_traverse` handler as *arg*. The
105+
the third parameter to the :c:member:`~PyTypeObject.tp_traverse` handler as *arg*. The
106106
Python core uses several visitor functions to implement cyclic garbage
107107
detection; it's not expected that users will need to write their own
108108
visitor functions.
109109
110-
The :attr:`tp_traverse` handler must have the following type:
110+
The :c:member:`~PyTypeObject.tp_traverse` handler must have the following type:
111111
112112
113113
.. c:type:: int (*traverseproc)(PyObject *self, visitproc visit, void *arg)
@@ -119,15 +119,15 @@ The :attr:`tp_traverse` handler must have the following type:
119119
object argument. If *visit* returns a non-zero value that value should be
120120
returned immediately.
121121
122-
To simplify writing :attr:`tp_traverse` handlers, a :c:func:`Py_VISIT` macro is
123-
provided. In order to use this macro, the :attr:`tp_traverse` implementation
122+
To simplify writing :c:member:`~PyTypeObject.tp_traverse` handlers, a :c:func:`Py_VISIT` macro is
123+
provided. In order to use this macro, the :c:member:`~PyTypeObject.tp_traverse` implementation
124124
must name its arguments exactly *visit* and *arg*:
125125
126126
127127
.. c:function:: void Py_VISIT(PyObject *o)
128128
129129
Call the *visit* callback, with arguments *o* and *arg*. If *visit* returns
130-
a non-zero value, then return it. Using this macro, :attr:`tp_traverse`
130+
a non-zero value, then return it. Using this macro, :c:member:`~PyTypeObject.tp_traverse`
131131
handlers look like::
132132
133133
static int
@@ -138,7 +138,7 @@ must name its arguments exactly *visit* and *arg*:
138138
return 0;
139139
}
140140
141-
The :attr:`tp_clear` handler must be of the :c:type:`inquiry` type, or *NULL*
141+
The :c:member:`~PyTypeObject.tp_clear` handler must be of the :c:type:`inquiry` type, or *NULL*
142142
if the object is immutable.
143143
144144

Doc/c-api/type.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ Type Objects
3737
3838
.. c:function:: long PyType_GetFlags(PyTypeObject* type)
3939
40-
Return the :attr:`tp_flags` member of *type*. This function is primarily
40+
Return the :c:member:`~PyTypeObject.tp_flags` member of *type*. This function is primarily
4141
meant for use with `Py_LIMITED_API`; the individual flag bits are
4242
guaranteed to be stable across Python releases, but access to
43-
:attr:`tp_flags` itself is not part of the limited API.
43+
:c:member:`~PyTypeObject.tp_flags` itself is not part of the limited API.
4444
4545
.. versionadded:: 3.2
4646
@@ -70,14 +70,14 @@ Type Objects
7070
7171
.. c:function:: PyObject* PyType_GenericAlloc(PyTypeObject *type, Py_ssize_t nitems)
7272
73-
Generic handler for the :attr:`tp_alloc` slot of a type object. Use
73+
Generic handler for the :c:member:`~PyTypeObject.tp_alloc` slot of a type object. Use
7474
Python's default memory allocation mechanism to allocate a new instance and
7575
initialize all its contents to *NULL*.
7676
7777
.. c:function:: PyObject* PyType_GenericNew(PyTypeObject *type, PyObject *args, PyObject *kwds)
7878
79-
Generic handler for the :attr:`tp_new` slot of a type object. Create a
80-
new instance using the type's :attr:`tp_alloc` slot.
79+
Generic handler for the :c:member:`~PyTypeObject.tp_new` slot of a type object. Create a
80+
new instance using the type's :c:member:`~PyTypeObject.tp_alloc` slot.
8181
8282
.. c:function:: int PyType_Ready(PyTypeObject *type)
8383

0 commit comments

Comments
 (0)