Skip to content

[3.12] gh-107298: Docs: add targets for some :c:member: and :c:macro: references (GH-107316) #107332

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 23 additions & 24 deletions Doc/c-api/tuple.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
32 changes: 17 additions & 15 deletions Doc/c-api/typeobj.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1513,21 +1513,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:

Expand Down
1 change: 0 additions & 1 deletion Doc/tools/.nitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ Doc/c-api/set.rst
Doc/c-api/stable.rst
Doc/c-api/structures.rst
Doc/c-api/sys.rst
Doc/c-api/tuple.rst
Doc/c-api/type.rst
Doc/c-api/typehints.rst
Doc/c-api/typeobj.rst
Expand Down