mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
gh-106919: Use role :c:macro: for referencing the C "constants" (GH-106920)
This commit is contained in:
parent
81861fd90b
commit
fcc816dbff
47 changed files with 311 additions and 293 deletions
|
@ -23,7 +23,7 @@ Object Protocol
|
|||
|
||||
Print an object *o*, on file *fp*. Returns ``-1`` on error. The flags argument
|
||||
is used to enable certain printing options. The only option currently supported
|
||||
is :const:`Py_PRINT_RAW`; if given, the :func:`str` of the object is written
|
||||
is :c:macro:`Py_PRINT_RAW`; if given, the :func:`str` of the object is written
|
||||
instead of the :func:`repr`.
|
||||
|
||||
|
||||
|
@ -199,8 +199,8 @@ Object Protocol
|
|||
.. c:function:: PyObject* PyObject_RichCompare(PyObject *o1, PyObject *o2, int opid)
|
||||
|
||||
Compare the values of *o1* and *o2* using the operation specified by *opid*,
|
||||
which must be one of :const:`Py_LT`, :const:`Py_LE`, :const:`Py_EQ`,
|
||||
:const:`Py_NE`, :const:`Py_GT`, or :const:`Py_GE`, corresponding to ``<``,
|
||||
which must be one of :c:macro:`Py_LT`, :c:macro:`Py_LE`, :c:macro:`Py_EQ`,
|
||||
:c:macro:`Py_NE`, :c:macro:`Py_GT`, or :c:macro:`Py_GE`, corresponding to ``<``,
|
||||
``<=``, ``==``, ``!=``, ``>``, or ``>=`` respectively. This is the equivalent of
|
||||
the Python expression ``o1 op o2``, where ``op`` is the operator corresponding
|
||||
to *opid*. Returns the value of the comparison on success, or ``NULL`` on failure.
|
||||
|
@ -209,8 +209,8 @@ Object Protocol
|
|||
.. c:function:: int PyObject_RichCompareBool(PyObject *o1, PyObject *o2, int opid)
|
||||
|
||||
Compare the values of *o1* and *o2* using the operation specified by *opid*,
|
||||
which must be one of :const:`Py_LT`, :const:`Py_LE`, :const:`Py_EQ`,
|
||||
:const:`Py_NE`, :const:`Py_GT`, or :const:`Py_GE`, corresponding to ``<``,
|
||||
which must be one of :c:macro:`Py_LT`, :c:macro:`Py_LE`, :c:macro:`Py_EQ`,
|
||||
:c:macro:`Py_NE`, :c:macro:`Py_GT`, or :c:macro:`Py_GE`, corresponding to ``<``,
|
||||
``<=``, ``==``, ``!=``, ``>``, or ``>=`` respectively. Returns ``-1`` on error,
|
||||
``0`` if the result is false, ``1`` otherwise. This is the equivalent of the
|
||||
Python expression ``o1 op o2``, where ``op`` is the operator corresponding to
|
||||
|
@ -218,7 +218,7 @@ Object Protocol
|
|||
|
||||
.. note::
|
||||
If *o1* and *o2* are the same object, :c:func:`PyObject_RichCompareBool`
|
||||
will always return ``1`` for :const:`Py_EQ` and ``0`` for :const:`Py_NE`.
|
||||
will always return ``1`` for :c:macro:`Py_EQ` and ``0`` for :c:macro:`Py_NE`.
|
||||
|
||||
.. c:function:: PyObject* PyObject_Format(PyObject *obj, PyObject *format_spec)
|
||||
|
||||
|
@ -468,10 +468,10 @@ Object Protocol
|
|||
.. c:function:: void *PyObject_GetItemData(PyObject *o)
|
||||
|
||||
Get a pointer to per-item data for a class with
|
||||
:const:`Py_TPFLAGS_ITEMS_AT_END`.
|
||||
:c:macro:`Py_TPFLAGS_ITEMS_AT_END`.
|
||||
|
||||
On error, set an exception and return ``NULL``.
|
||||
:py:exc:`TypeError` is raised if *o* does not have
|
||||
:const:`Py_TPFLAGS_ITEMS_AT_END` set.
|
||||
:c:macro:`Py_TPFLAGS_ITEMS_AT_END` set.
|
||||
|
||||
.. versionadded:: 3.12
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue