]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.11] gh-107298: Docs: add targets for some :c:member: and :c:macro: references...
authorSerhiy Storchaka <storchaka@gmail.com>
Thu, 27 Jul 2023 06:27:02 +0000 (09:27 +0300)
committerGitHub <noreply@github.com>
Thu, 27 Jul 2023 06:27:02 +0000 (09:27 +0300)
Add targets for PyStructSequence_Desc and PyStructSequence_Field members
and macros like Py_EQ.
Fix target for Py_RETURN_RICHCOMPARE.
(cherry picked from commit abec9a1b20b70d8ced401d59fc4f02b331c6568b)

Doc/c-api/tuple.rst
Doc/c-api/typeobj.rst

index 9fec738e68a9b42f5e9c516d116f9c5f5c6dd6c0..d298aaf3ab548479b806544fa84fde2229737d42 100644 (file)
@@ -144,20 +144,21 @@ type.
 
    Contains the meta information of a struct sequence type to create.
 
-   +-------------------+------------------------------+--------------------------------------+
-   | Field             | C Type                       | Meaning                              |
-   +===================+==============================+======================================+
-   | ``name``          | ``const char *``             | name of the struct sequence type     |
-   +-------------------+------------------------------+--------------------------------------+
-   | ``doc``           | ``const char *``             | pointer to docstring for the type    |
-   |                   |                              | or ``NULL`` to omit                  |
-   +-------------------+------------------------------+--------------------------------------+
-   | ``fields``        | ``PyStructSequence_Field *`` | pointer to ``NULL``-terminated array |
-   |                   |                              | with field names of the new type     |
-   +-------------------+------------------------------+--------------------------------------+
-   | ``n_in_sequence`` | ``int``                      | number of fields visible to the      |
-   |                   |                              | Python side (if used as tuple)       |
-   +-------------------+------------------------------+--------------------------------------+
+   .. c:member:: const char *name
+
+      Name of the struct sequence type.
+
+   .. c:member:: const char *doc
+
+      Pointer to docstring for the type or ``NULL`` to omit.
+
+   .. c:member:: PyStructSequence_Field *fields
+
+      Pointer to ``NULL``-terminated array with field names of the new type.
+
+   .. c:member:: int n_in_sequence
+
+      Number of fields visible to the Python side (if used as tuple).
 
 
 .. c:type:: PyStructSequence_Field
@@ -168,16 +169,14 @@ type.
    the :c:type:`PyStructSequence_Desc` determines which
    field of the struct sequence is described.
 
-   +-----------+------------------+-----------------------------------------+
-   | Field     | C Type           | Meaning                                 |
-   +===========+==================+=========================================+
-   | ``name``  | ``const char *`` | name for the field or ``NULL`` to end   |
-   |           |                  | the list of named fields, set to        |
-   |           |                  | :c:data:`PyStructSequence_UnnamedField` |
-   |           |                  | to leave unnamed                        |
-   +-----------+------------------+-----------------------------------------+
-   | ``doc``   | ``const char *`` | field docstring or ``NULL`` to omit     |
-   +-----------+------------------+-----------------------------------------+
+   .. c:member:: const char *name
+
+      Name for the field or ``NULL`` to end the list of named fields,
+      set to :c:data:`PyStructSequence_UnnamedField` to leave unnamed.
+
+   .. c:member:: const char *doc
+
+      Field docstring or ``NULL`` to omit.
 
 
 .. c:var:: const char * const PyStructSequence_UnnamedField
index 05b2f8a36c01a5c1d4a8dafc21d53b468005c8af..ec357450d004aa51668a6d518d5687e630fde540 100644 (file)
@@ -1449,21 +1449,23 @@ and :c:data:`PyType_Type` effectively act as defaults.)
    The following constants are defined to be used as the third argument for
    :c:member:`~PyTypeObject.tp_richcompare` and for :c:func:`PyObject_RichCompare`:
 
-   +------------------+------------+
-   | Constant         | Comparison |
-   +==================+============+
-   | :c:macro:`Py_LT` | ``<``      |
-   +------------------+------------+
-   | :c:macro:`Py_LE` | ``<=``     |
-   +------------------+------------+
-   | :c:macro:`Py_EQ` | ``==``     |
-   +------------------+------------+
-   | :c:macro:`Py_NE` | ``!=``     |
-   +------------------+------------+
-   | :c:macro:`Py_GT` | ``>``      |
-   +------------------+------------+
-   | :c:macro:`Py_GE` | ``>=``     |
-   +------------------+------------+
+   .. c:namespace:: NULL
+
+   +--------------------+------------+
+   | Constant           | Comparison |
+   +====================+============+
+   | .. c:macro:: Py_LT | ``<``      |
+   +--------------------+------------+
+   | .. c:macro:: Py_LE | ``<=``     |
+   +--------------------+------------+
+   | .. c:macro:: Py_EQ | ``==``     |
+   +--------------------+------------+
+   | .. c:macro:: Py_NE | ``!=``     |
+   +--------------------+------------+
+   | .. c:macro:: Py_GT | ``>``      |
+   +--------------------+------------+
+   | .. c:macro:: Py_GE | ``>=``     |
+   +--------------------+------------+
 
    The following macro is defined to ease writing rich comparison functions: