summaryrefslogtreecommitdiffstats
path: root/Doc/extending
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2023-07-21 07:52:07 (GMT)
committerGitHub <noreply@github.com>2023-07-21 07:52:07 (GMT)
commitfcc816dbff7ca66c26f57a506e4d2330fe41d0ff (patch)
tree98cc80573f16950153790ddbd7d017374d439d10 /Doc/extending
parent81861fd90b4ae981e7881cd03a3c370713063525 (diff)
downloadcpython-fcc816dbff7ca66c26f57a506e4d2330fe41d0ff.zip
cpython-fcc816dbff7ca66c26f57a506e4d2330fe41d0ff.tar.gz
cpython-fcc816dbff7ca66c26f57a506e4d2330fe41d0ff.tar.bz2
gh-106919: Use role :c:macro: for referencing the C "constants" (GH-106920)
Diffstat (limited to 'Doc/extending')
-rw-r--r--Doc/extending/extending.rst4
-rw-r--r--Doc/extending/newtypes_tutorial.rst8
2 files changed, 6 insertions, 6 deletions
diff --git a/Doc/extending/extending.rst b/Doc/extending/extending.rst
index 7d08bb9..0163ba1 100644
--- a/Doc/extending/extending.rst
+++ b/Doc/extending/extending.rst
@@ -337,7 +337,7 @@ When using only ``METH_VARARGS``, the function should expect the Python-level
parameters to be passed in as a tuple acceptable for parsing via
:c:func:`PyArg_ParseTuple`; more information on this function is provided below.
-The :const:`METH_KEYWORDS` bit may be set in the third field if keyword
+The :c:macro:`METH_KEYWORDS` bit may be set in the third field if keyword
arguments should be passed to the function. In this case, the C function should
accept a third ``PyObject *`` parameter which will be a dictionary of keywords.
Use :c:func:`PyArg_ParseTupleAndKeywords` to parse the arguments to such a
@@ -540,7 +540,7 @@ be part of a module definition::
}
This function must be registered with the interpreter using the
-:const:`METH_VARARGS` flag; this is described in section :ref:`methodtable`. The
+:c:macro:`METH_VARARGS` flag; this is described in section :ref:`methodtable`. The
:c:func:`PyArg_ParseTuple` function and its arguments are documented in section
:ref:`parsetuple`.
diff --git a/Doc/extending/newtypes_tutorial.rst b/Doc/extending/newtypes_tutorial.rst
index f89934a..ba09fb1 100644
--- a/Doc/extending/newtypes_tutorial.rst
+++ b/Doc/extending/newtypes_tutorial.rst
@@ -151,7 +151,7 @@ only used for variable-sized objects and should otherwise be zero.
base type will be :class:`object`, or else you will be adding data members to
your base type, and therefore increasing its size.
-We set the class flags to :const:`Py_TPFLAGS_DEFAULT`. ::
+We set the class flags to :c:macro:`Py_TPFLAGS_DEFAULT`. ::
.tp_flags = Py_TPFLAGS_DEFAULT,
@@ -498,7 +498,7 @@ definitions::
{NULL} /* Sentinel */
};
-(note that we used the :const:`METH_NOARGS` flag to indicate that the method
+(note that we used the :c:macro:`METH_NOARGS` flag to indicate that the method
is expecting no arguments other than *self*)
and assign it to the :c:member:`~PyTypeObject.tp_methods` slot::
@@ -508,7 +508,7 @@ and assign it to the :c:member:`~PyTypeObject.tp_methods` slot::
Finally, we'll make our type usable as a base class for subclassing. We've
written our methods carefully so far so that they don't make any assumptions
about the type of the object being created or used, so all we need to do is
-to add the :const:`Py_TPFLAGS_BASETYPE` to our class flag definition::
+to add the :c:macro:`Py_TPFLAGS_BASETYPE` to our class flag definition::
.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
@@ -774,7 +774,7 @@ and ``Custom_clear``::
Py_TYPE(self)->tp_free((PyObject *) self);
}
-Finally, we add the :const:`Py_TPFLAGS_HAVE_GC` flag to the class flags::
+Finally, we add the :c:macro:`Py_TPFLAGS_HAVE_GC` flag to the class flags::
.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC,