Skip to content

Commit 9513acf

Browse files
[3.11] gh-107298: Docs: add targets for some :c:member: and :c:macro: references (GH-107316) (GH-107333)
Add targets for PyStructSequence_Desc and PyStructSequence_Field members and macros like Py_EQ. Fix target for Py_RETURN_RICHCOMPARE. (cherry picked from commit abec9a1)
1 parent 17aada0 commit 9513acf

File tree

2 files changed

+40
-39
lines changed

2 files changed

+40
-39
lines changed

Doc/c-api/tuple.rst

+23-24
Original file line numberDiff line numberDiff line change
@@ -144,20 +144,21 @@ type.
144144
145145
Contains the meta information of a struct sequence type to create.
146146
147-
+-------------------+------------------------------+--------------------------------------+
148-
| Field | C Type | Meaning |
149-
+===================+==============================+======================================+
150-
| ``name`` | ``const char *`` | name of the struct sequence type |
151-
+-------------------+------------------------------+--------------------------------------+
152-
| ``doc`` | ``const char *`` | pointer to docstring for the type |
153-
| | | or ``NULL`` to omit |
154-
+-------------------+------------------------------+--------------------------------------+
155-
| ``fields`` | ``PyStructSequence_Field *`` | pointer to ``NULL``-terminated array |
156-
| | | with field names of the new type |
157-
+-------------------+------------------------------+--------------------------------------+
158-
| ``n_in_sequence`` | ``int`` | number of fields visible to the |
159-
| | | Python side (if used as tuple) |
160-
+-------------------+------------------------------+--------------------------------------+
147+
.. c:member:: const char *name
148+
149+
Name of the struct sequence type.
150+
151+
.. c:member:: const char *doc
152+
153+
Pointer to docstring for the type or ``NULL`` to omit.
154+
155+
.. c:member:: PyStructSequence_Field *fields
156+
157+
Pointer to ``NULL``-terminated array with field names of the new type.
158+
159+
.. c:member:: int n_in_sequence
160+
161+
Number of fields visible to the Python side (if used as tuple).
161162
162163
163164
.. c:type:: PyStructSequence_Field
@@ -168,16 +169,14 @@ type.
168169
the :c:type:`PyStructSequence_Desc` determines which
169170
field of the struct sequence is described.
170171
171-
+-----------+------------------+-----------------------------------------+
172-
| Field | C Type | Meaning |
173-
+===========+==================+=========================================+
174-
| ``name`` | ``const char *`` | name for the field or ``NULL`` to end |
175-
| | | the list of named fields, set to |
176-
| | | :c:data:`PyStructSequence_UnnamedField` |
177-
| | | to leave unnamed |
178-
+-----------+------------------+-----------------------------------------+
179-
| ``doc`` | ``const char *`` | field docstring or ``NULL`` to omit |
180-
+-----------+------------------+-----------------------------------------+
172+
.. c:member:: const char *name
173+
174+
Name for the field or ``NULL`` to end the list of named fields,
175+
set to :c:data:`PyStructSequence_UnnamedField` to leave unnamed.
176+
177+
.. c:member:: const char *doc
178+
179+
Field docstring or ``NULL`` to omit.
181180
182181
183182
.. c:var:: const char * const PyStructSequence_UnnamedField

Doc/c-api/typeobj.rst

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

1452-
+------------------+------------+
1453-
| Constant | Comparison |
1454-
+==================+============+
1455-
| :c:macro:`Py_LT` | ``<`` |
1456-
+------------------+------------+
1457-
| :c:macro:`Py_LE` | ``<=`` |
1458-
+------------------+------------+
1459-
| :c:macro:`Py_EQ` | ``==`` |
1460-
+------------------+------------+
1461-
| :c:macro:`Py_NE` | ``!=`` |
1462-
+------------------+------------+
1463-
| :c:macro:`Py_GT` | ``>`` |
1464-
+------------------+------------+
1465-
| :c:macro:`Py_GE` | ``>=`` |
1466-
+------------------+------------+
1452+
.. c:namespace:: NULL
1453+
1454+
+--------------------+------------+
1455+
| Constant | Comparison |
1456+
+====================+============+
1457+
| .. c:macro:: Py_LT | ``<`` |
1458+
+--------------------+------------+
1459+
| .. c:macro:: Py_LE | ``<=`` |
1460+
+--------------------+------------+
1461+
| .. c:macro:: Py_EQ | ``==`` |
1462+
+--------------------+------------+
1463+
| .. c:macro:: Py_NE | ``!=`` |
1464+
+--------------------+------------+
1465+
| .. c:macro:: Py_GT | ``>`` |
1466+
+--------------------+------------+
1467+
| .. c:macro:: Py_GE | ``>=`` |
1468+
+--------------------+------------+
14671469

14681470
The following macro is defined to ease writing rich comparison functions:
14691471

0 commit comments

Comments
 (0)