Skip to content

Commit 0e1f4a9

Browse files
gh-107298: Docs: add targets for some :c:member: and :c:macro: references
Add targets for PyStructSequence_Desc and PyStructSequence_Field members and macros like Py_EQ. Fix target for Py_RETURN_RICHCOMPARE.
1 parent 6d5b6e7 commit 0e1f4a9

File tree

2 files changed

+42
-40
lines changed

2 files changed

+42
-40
lines changed

Doc/c-api/tuple.rst

+25-25
Original file line numberDiff line numberDiff line change
@@ -147,39 +147,39 @@ type.
147147
148148
Contains the meta information of a struct sequence type to create.
149149
150-
+-------------------+------------------------------+--------------------------------------+
151-
| Field | C Type | Meaning |
152-
+===================+==============================+======================================+
153-
| ``name`` | ``const char *`` | name of the struct sequence type |
154-
+-------------------+------------------------------+--------------------------------------+
155-
| ``doc`` | ``const char *`` | pointer to docstring for the type |
156-
| | | or ``NULL`` to omit |
157-
+-------------------+------------------------------+--------------------------------------+
158-
| ``fields`` | ``PyStructSequence_Field *`` | pointer to ``NULL``-terminated array |
159-
| | | with field names of the new type |
160-
+-------------------+------------------------------+--------------------------------------+
161-
| ``n_in_sequence`` | ``int`` | number of fields visible to the |
162-
| | | Python side (if used as tuple) |
163-
+-------------------+------------------------------+--------------------------------------+
150+
.. c:member:: const char *name
151+
152+
name of the struct sequence type
153+
154+
.. c:member:: const char *doc
155+
156+
pointer to docstring for the type or ``NULL`` to omit
157+
158+
.. c:member:: PyStructSequence_Field *fields
159+
160+
pointer to ``NULL``-terminated array with field names of the new type
161+
162+
.. c:member:: int n_in_sequence
163+
164+
number of fields visible to the Python side (if used as tuple)
164165
165166
166167
.. c:type:: PyStructSequence_Field
167168
168169
Describes a field of a struct sequence. As a struct sequence is modeled as a
169170
tuple, all fields are typed as :c:expr:`PyObject*`. The index in the
170-
:attr:`fields` array of the :c:type:`PyStructSequence_Desc` determines which
171+
:c:member:`~PyStructSequence_Desc.fields` array of
172+
the :c:type:`PyStructSequence_Desc` determines which
171173
field of the struct sequence is described.
172174
173-
+-----------+------------------+-----------------------------------------+
174-
| Field | C Type | Meaning |
175-
+===========+==================+=========================================+
176-
| ``name`` | ``const char *`` | name for the field or ``NULL`` to end |
177-
| | | the list of named fields, set to |
178-
| | | :c:data:`PyStructSequence_UnnamedField` |
179-
| | | to leave unnamed |
180-
+-----------+------------------+-----------------------------------------+
181-
| ``doc`` | ``const char *`` | field docstring or ``NULL`` to omit |
182-
+-----------+------------------+-----------------------------------------+
175+
.. c:member:: const char *name
176+
177+
name for the field or ``NULL`` to end the list of named fields,
178+
set to :c:data:`PyStructSequence_UnnamedField` to leave unnamed
179+
180+
.. c:member:: const char *doc
181+
182+
field docstring or ``NULL`` to omit
183183
184184
185185
.. c:var:: const char * const PyStructSequence_UnnamedField

Doc/c-api/typeobj.rst

+17-15
Original file line numberDiff line numberDiff line change
@@ -1513,21 +1513,23 @@ and :c:data:`PyType_Type` effectively act as defaults.)
15131513
The following constants are defined to be used as the third argument for
15141514
:c:member:`~PyTypeObject.tp_richcompare` and for :c:func:`PyObject_RichCompare`:
15151515

1516-
+------------------+------------+
1517-
| Constant | Comparison |
1518-
+==================+============+
1519-
| :c:macro:`Py_LT` | ``<`` |
1520-
+------------------+------------+
1521-
| :c:macro:`Py_LE` | ``<=`` |
1522-
+------------------+------------+
1523-
| :c:macro:`Py_EQ` | ``==`` |
1524-
+------------------+------------+
1525-
| :c:macro:`Py_NE` | ``!=`` |
1526-
+------------------+------------+
1527-
| :c:macro:`Py_GT` | ``>`` |
1528-
+------------------+------------+
1529-
| :c:macro:`Py_GE` | ``>=`` |
1530-
+------------------+------------+
1516+
.. c:namespace:: NULL
1517+
1518+
+--------------------+------------+
1519+
| Constant | Comparison |
1520+
+====================+============+
1521+
| .. c:macro:: Py_LT | ``<`` |
1522+
+--------------------+------------+
1523+
| .. c:macro:: Py_LE | ``<=`` |
1524+
+--------------------+------------+
1525+
| .. c:macro:: Py_EQ | ``==`` |
1526+
+--------------------+------------+
1527+
| .. c:macro:: Py_NE | ``!=`` |
1528+
+--------------------+------------+
1529+
| .. c:macro:: Py_GT | ``>`` |
1530+
+--------------------+------------+
1531+
| .. c:macro:: Py_GE | ``>=`` |
1532+
+--------------------+------------+
15311533

15321534
The following macro is defined to ease writing rich comparison functions:
15331535

0 commit comments

Comments
 (0)