Commits

sandrotosi committed 74ff71b

update to new C roles and directives

Comments (0)

Files changed (122)

Doc/c-api/abstract.rst

 will raise a Python exception.
 
 It is not possible to use these functions on objects that are not properly
-initialized, such as a list object that has been created by :cfunc:`PyList_New`,
+initialized, such as a list object that has been created by :c:func:`PyList_New`,
 but whose items have not been set to some non-\ ``NULL`` value yet.
 
 .. toctree::

Doc/c-api/allocation.rst

 ==============================
 
 
-.. cfunction:: PyObject* _PyObject_New(PyTypeObject *type)
+.. c:function:: PyObject* _PyObject_New(PyTypeObject *type)
 
 
-.. cfunction:: PyVarObject* _PyObject_NewVar(PyTypeObject *type, Py_ssize_t size)
+.. c:function:: PyVarObject* _PyObject_NewVar(PyTypeObject *type, Py_ssize_t size)
 
    .. versionchanged:: 2.5
-      This function used an :ctype:`int` type for *size*. This might require
+      This function used an :c:type:`int` type for *size*. This might require
       changes in your code for properly supporting 64-bit systems.
 
 
-.. cfunction:: void _PyObject_Del(PyObject *op)
+.. c:function:: void _PyObject_Del(PyObject *op)
 
 
-.. cfunction:: PyObject* PyObject_Init(PyObject *op, PyTypeObject *type)
+.. c:function:: PyObject* PyObject_Init(PyObject *op, PyTypeObject *type)
 
    Initialize a newly-allocated object *op* with its type and initial
    reference.  Returns the initialized object.  If *type* indicates that the
    affected.
 
 
-.. cfunction:: PyVarObject* PyObject_InitVar(PyVarObject *op, PyTypeObject *type, Py_ssize_t size)
+.. c:function:: PyVarObject* PyObject_InitVar(PyVarObject *op, PyTypeObject *type, Py_ssize_t size)
 
-   This does everything :cfunc:`PyObject_Init` does, and also initializes the
+   This does everything :c:func:`PyObject_Init` does, and also initializes the
    length information for a variable-size object.
 
    .. versionchanged:: 2.5
-      This function used an :ctype:`int` type for *size*. This might require
+      This function used an :c:type:`int` type for *size*. This might require
       changes in your code for properly supporting 64-bit systems.
 
 
-.. cfunction:: TYPE* PyObject_New(TYPE, PyTypeObject *type)
+.. c:function:: TYPE* PyObject_New(TYPE, PyTypeObject *type)
 
    Allocate a new Python object using the C structure type *TYPE* and the
    Python type object *type*.  Fields not defined by the Python object header
    the type object.
 
 
-.. cfunction:: TYPE* PyObject_NewVar(TYPE, PyTypeObject *type, Py_ssize_t size)
+.. c:function:: TYPE* PyObject_NewVar(TYPE, PyTypeObject *type, Py_ssize_t size)
 
    Allocate a new Python object using the C structure type *TYPE* and the
    Python type object *type*.  Fields not defined by the Python object header
    improving the memory management efficiency.
 
    .. versionchanged:: 2.5
-      This function used an :ctype:`int` type for *size*. This might require
+      This function used an :c:type:`int` type for *size*. This might require
       changes in your code for properly supporting 64-bit systems.
 
 
-.. cfunction:: void PyObject_Del(PyObject *op)
+.. c:function:: void PyObject_Del(PyObject *op)
 
-   Releases memory allocated to an object using :cfunc:`PyObject_New` or
-   :cfunc:`PyObject_NewVar`.  This is normally called from the
+   Releases memory allocated to an object using :c:func:`PyObject_New` or
+   :c:func:`PyObject_NewVar`.  This is normally called from the
    :attr:`tp_dealloc` handler specified in the object's type.  The fields of
    the object should not be accessed after this call as the memory is no
    longer a valid Python object.
 
 
-.. cfunction:: PyObject* Py_InitModule(char *name, PyMethodDef *methods)
+.. c:function:: PyObject* Py_InitModule(char *name, PyMethodDef *methods)
 
    Create a new module object based on a name and table of functions,
    returning the new module object.
       *methods* argument.
 
 
-.. cfunction:: PyObject* Py_InitModule3(char *name, PyMethodDef *methods, char *doc)
+.. c:function:: PyObject* Py_InitModule3(char *name, PyMethodDef *methods, char *doc)
 
    Create a new module object based on a name and table of functions,
    returning the new module object.  If *doc* is non-*NULL*, it will be used
       *methods* argument.
 
 
-.. cfunction:: PyObject* Py_InitModule4(char *name, PyMethodDef *methods, char *doc, PyObject *self, int apiver)
+.. c:function:: PyObject* Py_InitModule4(char *name, PyMethodDef *methods, char *doc, PyObject *self, int apiver)
 
    Create a new module object based on a name and table of functions,
    returning the new module object.  If *doc* is non-*NULL*, it will be used
    .. note::
 
       Most uses of this function should probably be using the
-      :cfunc:`Py_InitModule3` instead; only use this if you are sure you need
+      :c:func:`Py_InitModule3` instead; only use this if you are sure you need
       it.
 
    .. versionchanged:: 2.3
       *methods* argument.
 
 
-.. cvar:: PyObject _Py_NoneStruct
+.. c:var:: PyObject _Py_NoneStruct
 
    Object which is visible in Python as ``None``.  This should only be
    accessed using the ``Py_None`` macro, which evaluates to a pointer to this

Doc/c-api/arg.rst

 methods.  Additional information and examples are available in
 :ref:`extending-index`.
 
-The first three of these functions described, :cfunc:`PyArg_ParseTuple`,
-:cfunc:`PyArg_ParseTupleAndKeywords`, and :cfunc:`PyArg_Parse`, all use
+The first three of these functions described, :c:func:`PyArg_ParseTuple`,
+:c:func:`PyArg_ParseTupleAndKeywords`, and :c:func:`PyArg_Parse`, all use
 *format strings* which are used to tell the function about the expected
 arguments.  The format strings use the same syntax for each of these
 functions.
    raised. Unicode objects are converted to C strings using the default
    encoding.  If this conversion fails, a :exc:`UnicodeError` is raised.
 
-``s#`` (string, Unicode or any read buffer compatible object) [const char \*, int (or :ctype:`Py_ssize_t`, see below)]
+``s#`` (string, Unicode or any read buffer compatible object) [const char \*, int (or :c:type:`Py_ssize_t`, see below)]
    This variant on ``s`` stores into two C variables, the first one a pointer
    to a character string, the second one its length.  In this case the Python
    string may contain embedded null bytes.  Unicode objects pass back a
    a reference to the raw internal data representation.
 
    Starting with Python 2.5 the type of the length argument can be controlled
-   by defining the macro :cmacro:`PY_SSIZE_T_CLEAN` before including
-   :file:`Python.h`.  If the macro is defined, length is a :ctype:`Py_ssize_t`
+   by defining the macro :c:macro:`PY_SSIZE_T_CLEAN` before including
+   :file:`Python.h`.  If the macro is defined, length is a :c:type:`Py_ssize_t`
    rather than an int.
 
 ``s*`` (string, Unicode, or any buffer compatible object) [Py_buffer]
    Convert a Python Unicode object to a C pointer to a NUL-terminated buffer
    of 16-bit Unicode (UTF-16) data.  As with ``s``, there is no need to
    provide storage for the Unicode data buffer; a pointer to the existing
-   Unicode data is stored into the :ctype:`Py_UNICODE` pointer variable whose
+   Unicode data is stored into the :c:type:`Py_UNICODE` pointer variable whose
    address you pass.
 
 ``u#`` (Unicode) [Py_UNICODE \*, int]
    This variant on ``u`` stores into two C variables, the first one a pointer
    to a Unicode data buffer, the second one its length. Non-Unicode objects
    are handled by interpreting their read-buffer pointer as pointer to a
-   :ctype:`Py_UNICODE` array.
+   :c:type:`Py_UNICODE` array.
 
 ``es`` (string, Unicode or character buffer compatible object) [const char \*encoding, char \*\*buffer]
    This variant on ``s`` is used for encoding Unicode and objects convertible
    embedded NUL bytes.
 
    This format requires two arguments.  The first is only used as input, and
-   must be a :ctype:`const char\*` which points to the name of an encoding as
+   must be a :c:type:`const char\*` which points to the name of an encoding as
    a NUL-terminated string, or *NULL*, in which case the default encoding is
    used.  An exception is raised if the named encoding is not known to Python.
-   The second argument must be a :ctype:`char\*\*`; the value of the pointer
+   The second argument must be a :c:type:`char\*\*`; the value of the pointer
    it references will be set to a buffer with the contents of the argument
    text.  The text will be encoded in the encoding specified by the first
    argument.
 
-   :cfunc:`PyArg_ParseTuple` will allocate a buffer of the needed size, copy
+   :c:func:`PyArg_ParseTuple` will allocate a buffer of the needed size, copy
    the encoded data into this buffer and adjust *\*buffer* to reference the
    newly allocated storage.  The caller is responsible for calling
-   :cfunc:`PyMem_Free` to free the allocated buffer after use.
+   :c:func:`PyMem_Free` to free the allocated buffer after use.
 
 ``et`` (string, Unicode or character buffer compatible object) [const char \*encoding, char \*\*buffer]
    Same as ``es`` except that 8-bit string objects are passed through without
    allows input data which contains NUL characters.
 
    It requires three arguments.  The first is only used as input, and must be
-   a :ctype:`const char\*` which points to the name of an encoding as a
+   a :c:type:`const char\*` which points to the name of an encoding as a
    NUL-terminated string, or *NULL*, in which case the default encoding is
    used.  An exception is raised if the named encoding is not known to Python.
-   The second argument must be a :ctype:`char\*\*`; the value of the pointer
+   The second argument must be a :c:type:`char\*\*`; the value of the pointer
    it references will be set to a buffer with the contents of the argument
    text.  The text will be encoded in the encoding specified by the first
    argument.  The third argument must be a pointer to an integer; the
    If *\*buffer* points a *NULL* pointer, the function will allocate a buffer
    of the needed size, copy the encoded data into this buffer and set
    *\*buffer* to reference the newly allocated storage.  The caller is
-   responsible for calling :cfunc:`PyMem_Free` to free the allocated buffer
+   responsible for calling :c:func:`PyMem_Free` to free the allocated buffer
    after usage.
 
    If *\*buffer* points to a non-*NULL* pointer (an already allocated buffer),
-   :cfunc:`PyArg_ParseTuple` will use this location as the buffer and
+   :c:func:`PyArg_ParseTuple` will use this location as the buffer and
    interpret the initial value of *\*buffer_length* as the buffer size.  It
    will then copy the encoded data into the buffer and NUL-terminate it.  If
    the buffer is not large enough, a :exc:`ValueError` will be set.
 
 ``b`` (integer) [unsigned char]
    Convert a nonnegative Python integer to an unsigned tiny int, stored in a C
-   :ctype:`unsigned char`.
+   :c:type:`unsigned char`.
 
 ``B`` (integer) [unsigned char]
    Convert a Python integer to a tiny int without overflow checking, stored in
-   a C :ctype:`unsigned char`.
+   a C :c:type:`unsigned char`.
 
    .. versionadded:: 2.3
 
 ``h`` (integer) [short int]
-   Convert a Python integer to a C :ctype:`short int`.
+   Convert a Python integer to a C :c:type:`short int`.
 
 ``H`` (integer) [unsigned short int]
-   Convert a Python integer to a C :ctype:`unsigned short int`, without
+   Convert a Python integer to a C :c:type:`unsigned short int`, without
    overflow checking.
 
    .. versionadded:: 2.3
 
 ``i`` (integer) [int]
-   Convert a Python integer to a plain C :ctype:`int`.
+   Convert a Python integer to a plain C :c:type:`int`.
 
 ``I`` (integer) [unsigned int]
-   Convert a Python integer to a C :ctype:`unsigned int`, without overflow
+   Convert a Python integer to a C :c:type:`unsigned int`, without overflow
    checking.
 
    .. versionadded:: 2.3
 
 ``l`` (integer) [long int]
-   Convert a Python integer to a C :ctype:`long int`.
+   Convert a Python integer to a C :c:type:`long int`.
 
 ``k`` (integer) [unsigned long]
-   Convert a Python integer or long integer to a C :ctype:`unsigned long`
+   Convert a Python integer or long integer to a C :c:type:`unsigned long`
    without overflow checking.
 
    .. versionadded:: 2.3
 
 ``L`` (integer) [PY_LONG_LONG]
-   Convert a Python integer to a C :ctype:`long long`.  This format is only
-   available on platforms that support :ctype:`long long` (or :ctype:`_int64`
+   Convert a Python integer to a C :c:type:`long long`.  This format is only
+   available on platforms that support :c:type:`long long` (or :c:type:`_int64`
    on Windows).
 
 ``K`` (integer) [unsigned PY_LONG_LONG]
-   Convert a Python integer or long integer to a C :ctype:`unsigned long long`
+   Convert a Python integer or long integer to a C :c:type:`unsigned long long`
    without overflow checking.  This format is only available on platforms that
-   support :ctype:`unsigned long long` (or :ctype:`unsigned _int64` on
+   support :c:type:`unsigned long long` (or :c:type:`unsigned _int64` on
    Windows).
 
    .. versionadded:: 2.3
 
 ``n`` (integer) [Py_ssize_t]
-   Convert a Python integer or long integer to a C :ctype:`Py_ssize_t`.
+   Convert a Python integer or long integer to a C :c:type:`Py_ssize_t`.
 
    .. versionadded:: 2.5
 
 ``c`` (string of length 1) [char]
    Convert a Python character, represented as a string of length 1, to a C
-   :ctype:`char`.
+   :c:type:`char`.
 
 ``f`` (float) [float]
-   Convert a Python floating point number to a C :ctype:`float`.
+   Convert a Python floating point number to a C :c:type:`float`.
 
 ``d`` (float) [double]
-   Convert a Python floating point number to a C :ctype:`double`.
+   Convert a Python floating point number to a C :c:type:`double`.
 
 ``D`` (complex) [Py_complex]
-   Convert a Python complex number to a C :ctype:`Py_complex` structure.
+   Convert a Python complex number to a C :c:type:`Py_complex` structure.
 
 ``O`` (object) [PyObject \*]
    Store a Python object (without any conversion) in a C object pointer.  The
 ``O!`` (object) [*typeobject*, PyObject \*]
    Store a Python object in a C object pointer.  This is similar to ``O``, but
    takes two C arguments: the first is the address of a Python type object,
-   the second is the address of the C variable (of type :ctype:`PyObject\*`)
+   the second is the address of the C variable (of type :c:type:`PyObject\*`)
    into which the object pointer is stored.  If the Python object does not
    have the required type, :exc:`TypeError` is raised.
 
 ``O&`` (object) [*converter*, *anything*]
    Convert a Python object to a C variable through a *converter* function.
    This takes two arguments: the first is a function, the second is the
-   address of a C variable (of arbitrary type), converted to :ctype:`void \*`.
+   address of a C variable (of arbitrary type), converted to :c:type:`void \*`.
    The *converter* function in turn is called as follows::
 
       status = converter(object, address);
 
    where *object* is the Python object to be converted and *address* is the
-   :ctype:`void\*` argument that was passed to the :cfunc:`PyArg_Parse\*`
+   :c:type:`void\*` argument that was passed to the :c:func:`PyArg_Parse\*`
    function.  The returned *status* should be ``1`` for a successful
    conversion and ``0`` if the conversion has failed.  When the conversion
    fails, the *converter* function should raise an exception and leave the
 ``S`` (string) [PyStringObject \*]
    Like ``O`` but requires that the Python object is a string object.  Raises
    :exc:`TypeError` if the object is not a string object.  The C variable may
-   also be declared as :ctype:`PyObject\*`.
+   also be declared as :c:type:`PyObject\*`.
 
 ``U`` (Unicode string) [PyUnicodeObject \*]
    Like ``O`` but requires that the Python object is a Unicode object.  Raises
    :exc:`TypeError` if the object is not a Unicode object.  The C variable may
-   also be declared as :ctype:`PyObject\*`.
+   also be declared as :c:type:`PyObject\*`.
 
 ``t#`` (read-only character buffer) [char \*, int]
    Like ``s#``, but accepts any object which implements the read-only buffer
-   interface.  The :ctype:`char\*` variable is set to point to the first byte
-   of the buffer, and the :ctype:`int` is set to the length of the buffer.
+   interface.  The :c:type:`char\*` variable is set to point to the first byte
+   of the buffer, and the :c:type:`int` is set to the length of the buffer.
    Only single-segment buffer objects are accepted; :exc:`TypeError` is raised
    for all others.
 
 
 ``w#`` (read-write character buffer) [char \*, Py_ssize_t]
    Like ``s#``, but accepts any object which implements the read-write buffer
-   interface.  The :ctype:`char \*` variable is set to point to the first byte
-   of the buffer, and the :ctype:`Py_ssize_t` is set to the length of the
+   interface.  The :c:type:`char \*` variable is set to point to the first byte
+   of the buffer, and the :c:type:`Py_ssize_t` is set to the length of the
    buffer.  Only single-segment buffer objects are accepted; :exc:`TypeError`
    is raised for all others.
 
    Indicates that the remaining arguments in the Python argument list are
    optional.  The C variables corresponding to optional arguments should be
    initialized to their default value --- when an optional argument is not
-   specified, :cfunc:`PyArg_ParseTuple` does not touch the contents of the
+   specified, :c:func:`PyArg_ParseTuple` does not touch the contents of the
    corresponding C variable(s).
 
 ``:``
    The list of format units ends here; the string after the colon is used as
    the function name in error messages (the "associated value" of the
-   exception that :cfunc:`PyArg_ParseTuple` raises).
+   exception that :c:func:`PyArg_ParseTuple` raises).
 
 ``;``
    The list of format units ends here; the string after the semicolon is used
 should match what is specified for the corresponding format unit in that case.
 
 For the conversion to succeed, the *arg* object must match the format and the
-format must be exhausted.  On success, the :cfunc:`PyArg_Parse\*` functions
+format must be exhausted.  On success, the :c:func:`PyArg_Parse\*` functions
 return true, otherwise they return false and raise an appropriate exception.
-When the :cfunc:`PyArg_Parse\*` functions fail due to conversion failure in
+When the :c:func:`PyArg_Parse\*` functions fail due to conversion failure in
 one of the format units, the variables at the addresses corresponding to that
 and the following format units are left untouched.
 
 
-.. cfunction:: int PyArg_ParseTuple(PyObject *args, const char *format, ...)
+.. c:function:: int PyArg_ParseTuple(PyObject *args, const char *format, ...)
 
    Parse the parameters of a function that takes only positional parameters
    into local variables.  Returns true on success; on failure, it returns
    false and raises the appropriate exception.
 
 
-.. cfunction:: int PyArg_VaParse(PyObject *args, const char *format, va_list vargs)
+.. c:function:: int PyArg_VaParse(PyObject *args, const char *format, va_list vargs)
 
-   Identical to :cfunc:`PyArg_ParseTuple`, except that it accepts a va_list
+   Identical to :c:func:`PyArg_ParseTuple`, except that it accepts a va_list
    rather than a variable number of arguments.
 
 
-.. cfunction:: int PyArg_ParseTupleAndKeywords(PyObject *args, PyObject *kw, const char *format, char *keywords[], ...)
+.. c:function:: int PyArg_ParseTupleAndKeywords(PyObject *args, PyObject *kw, const char *format, char *keywords[], ...)
 
    Parse the parameters of a function that takes both positional and keyword
    parameters into local variables.  Returns true on success; on failure, it
    returns false and raises the appropriate exception.
 
 
-.. cfunction:: int PyArg_VaParseTupleAndKeywords(PyObject *args, PyObject *kw, const char *format, char *keywords[], va_list vargs)
+.. c:function:: int PyArg_VaParseTupleAndKeywords(PyObject *args, PyObject *kw, const char *format, char *keywords[], va_list vargs)
 
-   Identical to :cfunc:`PyArg_ParseTupleAndKeywords`, except that it accepts a
+   Identical to :c:func:`PyArg_ParseTupleAndKeywords`, except that it accepts a
    va_list rather than a variable number of arguments.
 
 
-.. cfunction:: int PyArg_Parse(PyObject *args, const char *format, ...)
+.. c:function:: int PyArg_Parse(PyObject *args, const char *format, ...)
 
    Function used to deconstruct the argument lists of "old-style" functions
    --- these are functions which use the :const:`METH_OLDARGS` parameter
    purpose.
 
 
-.. cfunction:: int PyArg_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssize_t max, ...)
+.. c:function:: int PyArg_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssize_t max, ...)
 
    A simpler form of parameter retrieval which does not use a format string to
    specify the types of the arguments.  Functions which use this method to
    should be passed as *args*; it must actually be a tuple.  The length of the
    tuple must be at least *min* and no more than *max*; *min* and *max* may be
    equal.  Additional arguments must be passed to the function, each of which
-   should be a pointer to a :ctype:`PyObject\*` variable; these will be filled
+   should be a pointer to a :c:type:`PyObject\*` variable; these will be filled
    in with the values from *args*; they will contain borrowed references.  The
    variables which correspond to optional parameters not given by *args* will
    not be filled in; these should be initialized by the caller. This function
           return result;
       }
 
-   The call to :cfunc:`PyArg_UnpackTuple` in this example is entirely
-   equivalent to this call to :cfunc:`PyArg_ParseTuple`::
+   The call to :c:func:`PyArg_UnpackTuple` in this example is entirely
+   equivalent to this call to :c:func:`PyArg_ParseTuple`::
 
       PyArg_ParseTuple(args, "O|O:ref", &object, &callback)
 
    .. versionadded:: 2.2
 
    .. versionchanged:: 2.5
-      This function used an :ctype:`int` type for *min* and *max*. This might
+      This function used an :c:type:`int` type for *min* and *max*. This might
       require changes in your code for properly supporting 64-bit systems.
 
 
-.. cfunction:: PyObject* Py_BuildValue(const char *format, ...)
+.. c:function:: PyObject* Py_BuildValue(const char *format, ...)
 
    Create a new value based on a format string similar to those accepted by
-   the :cfunc:`PyArg_Parse\*` family of functions and a sequence of values.
+   the :c:func:`PyArg_Parse\*` family of functions and a sequence of values.
    Returns the value or *NULL* in the case of an error; an exception will be
    raised if *NULL* is returned.
 
-   :cfunc:`Py_BuildValue` does not always build a tuple.  It builds a tuple
+   :c:func:`Py_BuildValue` does not always build a tuple.  It builds a tuple
    only if its format string contains two or more format units.  If the format
    string is empty, it returns ``None``; if it contains exactly one format
    unit, it returns whatever object is described by that format unit.  To
    When memory buffers are passed as parameters to supply data to build
    objects, as for the ``s`` and ``s#`` formats, the required data is copied.
    Buffers provided by the caller are never referenced by the objects created
-   by :cfunc:`Py_BuildValue`.  In other words, if your code invokes
-   :cfunc:`malloc` and passes the allocated memory to :cfunc:`Py_BuildValue`,
-   your code is responsible for calling :cfunc:`free` for that memory once
-   :cfunc:`Py_BuildValue` returns.
+   by :c:func:`Py_BuildValue`.  In other words, if your code invokes
+   :c:func:`malloc` and passes the allocated memory to :c:func:`Py_BuildValue`,
+   your code is responsible for calling :c:func:`free` for that memory once
+   :c:func:`Py_BuildValue` returns.
 
    In the following description, the quoted form is the format unit; the entry
    in (round) parentheses is the Python object type that the format unit will
       length is ignored and ``None`` is returned.
 
    ``i`` (integer) [int]
-      Convert a plain C :ctype:`int` to a Python integer object.
+      Convert a plain C :c:type:`int` to a Python integer object.
 
    ``b`` (integer) [char]
-      Convert a plain C :ctype:`char` to a Python integer object.
+      Convert a plain C :c:type:`char` to a Python integer object.
 
    ``h`` (integer) [short int]
-      Convert a plain C :ctype:`short int` to a Python integer object.
+      Convert a plain C :c:type:`short int` to a Python integer object.
 
    ``l`` (integer) [long int]
-      Convert a C :ctype:`long int` to a Python integer object.
+      Convert a C :c:type:`long int` to a Python integer object.
 
    ``B`` (integer) [unsigned char]
-      Convert a C :ctype:`unsigned char` to a Python integer object.
+      Convert a C :c:type:`unsigned char` to a Python integer object.
 
    ``H`` (integer) [unsigned short int]
-      Convert a C :ctype:`unsigned short int` to a Python integer object.
+      Convert a C :c:type:`unsigned short int` to a Python integer object.
 
    ``I`` (integer/long) [unsigned int]
-      Convert a C :ctype:`unsigned int` to a Python integer object or a Python
+      Convert a C :c:type:`unsigned int` to a Python integer object or a Python
       long integer object, if it is larger than ``sys.maxint``.
 
    ``k`` (integer/long) [unsigned long]
-      Convert a C :ctype:`unsigned long` to a Python integer object or a
+      Convert a C :c:type:`unsigned long` to a Python integer object or a
       Python long integer object, if it is larger than ``sys.maxint``.
 
    ``L`` (long) [PY_LONG_LONG]
-      Convert a C :ctype:`long long` to a Python long integer object. Only
-      available on platforms that support :ctype:`long long`.
+      Convert a C :c:type:`long long` to a Python long integer object. Only
+      available on platforms that support :c:type:`long long`.
 
    ``K`` (long) [unsigned PY_LONG_LONG]
-      Convert a C :ctype:`unsigned long long` to a Python long integer object.
-      Only available on platforms that support :ctype:`unsigned long long`.
+      Convert a C :c:type:`unsigned long long` to a Python long integer object.
+      Only available on platforms that support :c:type:`unsigned long long`.
 
    ``n`` (int) [Py_ssize_t]
-      Convert a C :ctype:`Py_ssize_t` to a Python integer or long integer.
+      Convert a C :c:type:`Py_ssize_t` to a Python integer or long integer.
 
       .. versionadded:: 2.5
 
    ``c`` (string of length 1) [char]
-      Convert a C :ctype:`int` representing a character to a Python string of
+      Convert a C :c:type:`int` representing a character to a Python string of
       length 1.
 
    ``d`` (float) [double]
-      Convert a C :ctype:`double` to a Python floating point number.
+      Convert a C :c:type:`double` to a Python floating point number.
 
    ``f`` (float) [float]
       Same as ``d``.
 
    ``D`` (complex) [Py_complex \*]
-      Convert a C :ctype:`Py_complex` structure to a Python complex number.
+      Convert a C :c:type:`Py_complex` structure to a Python complex number.
 
    ``O`` (object) [PyObject \*]
       Pass a Python object untouched (except for its reference count, which is
       incremented by one).  If the object passed in is a *NULL* pointer, it is
       assumed that this was caused because the call producing the argument
-      found an error and set an exception. Therefore, :cfunc:`Py_BuildValue`
+      found an error and set an exception. Therefore, :c:func:`Py_BuildValue`
       will return *NULL* but won't raise an exception.  If no exception has
       been raised yet, :exc:`SystemError` is set.
 
    ``O&`` (object) [*converter*, *anything*]
       Convert *anything* to a Python object through a *converter* function.
       The function is called with *anything* (which should be compatible with
-      :ctype:`void \*`) as its argument and should return a "new" Python
+      :c:type:`void \*`) as its argument and should return a "new" Python
       object, or *NULL* if an error occurred.
 
    ``(items)`` (tuple) [*matching-items*]
    If there is an error in the format string, the :exc:`SystemError` exception
    is set and *NULL* returned.
 
-.. cfunction:: PyObject* Py_VaBuildValue(const char *format, va_list vargs)
+.. c:function:: PyObject* Py_VaBuildValue(const char *format, va_list vargs)
 
-   Identical to :cfunc:`Py_BuildValue`, except that it accepts a va_list
+   Identical to :c:func:`Py_BuildValue`, except that it accepts a va_list
    rather than a variable number of arguments.

Doc/c-api/bool.rst

 are available, however.
 
 
-.. cfunction:: int PyBool_Check(PyObject *o)
+.. c:function:: int PyBool_Check(PyObject *o)
 
-   Return true if *o* is of type :cdata:`PyBool_Type`.
+   Return true if *o* is of type :c:data:`PyBool_Type`.
 
    .. versionadded:: 2.3
 
 
-.. cvar:: PyObject* Py_False
+.. c:var:: PyObject* Py_False
 
    The Python ``False`` object.  This object has no methods.  It needs to be
    treated just like any other object with respect to reference counts.
 
 
-.. cvar:: PyObject* Py_True
+.. c:var:: PyObject* Py_True
 
    The Python ``True`` object.  This object has no methods.  It needs to be treated
    just like any other object with respect to reference counts.
 
 
-.. cmacro:: Py_RETURN_FALSE
+.. c:macro:: Py_RETURN_FALSE
 
    Return :const:`Py_False` from a function, properly incrementing its reference
    count.
    .. versionadded:: 2.4
 
 
-.. cmacro:: Py_RETURN_TRUE
+.. c:macro:: Py_RETURN_TRUE
 
    Return :const:`Py_True` from a function, properly incrementing its reference
    count.
    .. versionadded:: 2.4
 
 
-.. cfunction:: PyObject* PyBool_FromLong(long v)
+.. c:function:: PyObject* PyBool_FromLong(long v)
 
    Return a new reference to :const:`Py_True` or :const:`Py_False` depending on the
    truth value of *v*.

Doc/c-api/buffer.rst

 An example user of the buffer interface is the file object's :meth:`write`
 method. Any object that can export a series of bytes through the buffer
 interface can be written to a file. There are a number of format codes to
-:cfunc:`PyArg_ParseTuple` that operate against an object's buffer interface,
+:c:func:`PyArg_ParseTuple` that operate against an object's buffer interface,
 returning data from the target object.
 
 Starting from version 1.6, Python has been providing Python-level buffer
 ==============================
 
 
-.. ctype:: Py_buffer
+.. c:type:: Py_buffer
 
-   .. cmember:: void *buf
+   .. c:member:: void *buf
 
       A pointer to the start of the memory for the object.
 
-   .. cmember:: Py_ssize_t len
+   .. c:member:: Py_ssize_t len
       :noindex:
 
       The total length of the memory in bytes.
 
-   .. cmember:: int readonly
+   .. c:member:: int readonly
 
       An indicator of whether the buffer is read only.
 
-   .. cmember:: const char *format
+   .. c:member:: const char *format
       :noindex:
 
       A *NULL* terminated string in :mod:`struct` module style syntax giving
       the contents of the elements available through the buffer.  If this is
       *NULL*, ``"B"`` (unsigned bytes) is assumed.
 
-   .. cmember:: int ndim
+   .. c:member:: int ndim
 
       The number of dimensions the memory represents as a multi-dimensional
-      array.  If it is 0, :cdata:`strides` and :cdata:`suboffsets` must be
+      array.  If it is 0, :c:data:`strides` and :c:data:`suboffsets` must be
       *NULL*.
 
-   .. cmember:: Py_ssize_t *shape
+   .. c:member:: Py_ssize_t *shape
 
-      An array of :ctype:`Py_ssize_t`\s the length of :cdata:`ndim` giving the
+      An array of :c:type:`Py_ssize_t`\s the length of :c:data:`ndim` giving the
       shape of the memory as a multi-dimensional array.  Note that
       ``((*shape)[0] * ... * (*shape)[ndims-1])*itemsize`` should be equal to
-      :cdata:`len`.
+      :c:data:`len`.
 
-   .. cmember:: Py_ssize_t *strides
+   .. c:member:: Py_ssize_t *strides
 
-      An array of :ctype:`Py_ssize_t`\s the length of :cdata:`ndim` giving the
+      An array of :c:type:`Py_ssize_t`\s the length of :c:data:`ndim` giving the
       number of bytes to skip to get to a new element in each dimension.
 
-   .. cmember:: Py_ssize_t *suboffsets
+   .. c:member:: Py_ssize_t *suboffsets
 
-      An array of :ctype:`Py_ssize_t`\s the length of :cdata:`ndim`.  If these
+      An array of :c:type:`Py_ssize_t`\s the length of :c:data:`ndim`.  If these
       suboffset numbers are greater than or equal to 0, then the value stored
       along the indicated dimension is a pointer and the suboffset value
       dictates how many bytes to add to the pointer after de-referencing. A
            }
 
 
-   .. cmember:: Py_ssize_t itemsize
+   .. c:member:: Py_ssize_t itemsize
 
       This is a storage for the itemsize (in bytes) of each element of the
       shared memory. It is technically un-necessary as it can be obtained
-      using :cfunc:`PyBuffer_SizeFromFormat`, however an exporter may know
+      using :c:func:`PyBuffer_SizeFromFormat`, however an exporter may know
       this information without parsing the format string and it is necessary
       to know the itemsize for proper interpretation of striding. Therefore,
       storing it is more convenient and faster.
 
-   .. cmember:: void *internal
+   .. c:member:: void *internal
 
       This is for use internally by the exporting object. For example, this
       might be re-cast as an integer by the exporter and used to store flags
 ========================
 
 
-.. cfunction:: int PyObject_CheckBuffer(PyObject *obj)
+.. c:function:: int PyObject_CheckBuffer(PyObject *obj)
 
    Return 1 if *obj* supports the buffer interface otherwise 0.
 
 
-.. cfunction:: int PyObject_GetBuffer(PyObject *obj, Py_buffer *view, int flags)
+.. c:function:: int PyObject_GetBuffer(PyObject *obj, Py_buffer *view, int flags)
 
-      Export *obj* into a :ctype:`Py_buffer`, *view*.  These arguments must
+      Export *obj* into a :c:type:`Py_buffer`, *view*.  These arguments must
       never be *NULL*.  The *flags* argument is a bit field indicating what
       kind of buffer the caller is prepared to deal with and therefore what
       kind of buffer the exporter is allowed to return.  The buffer interface
       just not possible. These errors should be a :exc:`BufferError` unless
       there is another error that is actually causing the problem. The
       exporter can use flags information to simplify how much of the
-      :cdata:`Py_buffer` structure is filled in with non-default values and/or
+      :c:data:`Py_buffer` structure is filled in with non-default values and/or
       raise an error if the object can't support a simpler view of its memory.
 
       0 is returned on success and -1 on error.
 
       The following table gives possible values to the *flags* arguments.
 
-      +------------------------------+---------------------------------------------------+
-      | Flag                         | Description                                       |
-      +==============================+===================================================+
-      | :cmacro:`PyBUF_SIMPLE`       | This is the default flag state.  The returned     |
-      |                              | buffer may or may not have writable memory.  The  |
-      |                              | format of the data will be assumed to be unsigned |
-      |                              | bytes.  This is a "stand-alone" flag constant. It |
-      |                              | never needs to be '|'d to the others. The exporter|
-      |                              | will raise an error if it cannot provide such a   |
-      |                              | contiguous buffer of bytes.                       |
-      |                              |                                                   |
-      +------------------------------+---------------------------------------------------+
-      | :cmacro:`PyBUF_WRITABLE`     | The returned buffer must be writable.  If it is   |
-      |                              | not writable, then raise an error.                |
-      +------------------------------+---------------------------------------------------+
-      | :cmacro:`PyBUF_STRIDES`      | This implies :cmacro:`PyBUF_ND`. The returned     |
-      |                              | buffer must provide strides information (i.e. the |
-      |                              | strides cannot be NULL). This would be used when  |
-      |                              | the consumer can handle strided, discontiguous    |
-      |                              | arrays.  Handling strides automatically assumes   |
-      |                              | you can handle shape.  The exporter can raise an  |
-      |                              | error if a strided representation of the data is  |
-      |                              | not possible (i.e. without the suboffsets).       |
-      |                              |                                                   |
-      +------------------------------+---------------------------------------------------+
-      | :cmacro:`PyBUF_ND`           | The returned buffer must provide shape            |
-      |                              | information. The memory will be assumed C-style   |
-      |                              | contiguous (last dimension varies the             |
-      |                              | fastest). The exporter may raise an error if it   |
-      |                              | cannot provide this kind of contiguous buffer. If |
-      |                              | this is not given then shape will be *NULL*.      |
-      |                              |                                                   |
-      |                              |                                                   |
-      |                              |                                                   |
-      +------------------------------+---------------------------------------------------+
-      |:cmacro:`PyBUF_C_CONTIGUOUS`  | These flags indicate that the contiguity returned |
-      |:cmacro:`PyBUF_F_CONTIGUOUS`  | buffer must be respectively, C-contiguous (last   |
-      |:cmacro:`PyBUF_ANY_CONTIGUOUS`| dimension varies the fastest), Fortran contiguous |
-      |                              | (first dimension varies the fastest) or either    |
-      |                              | one.  All of these flags imply                    |
-      |                              | :cmacro:`PyBUF_STRIDES` and guarantee that the    |
-      |                              | strides buffer info structure will be filled in   |
-      |                              | correctly.                                        |
-      |                              |                                                   |
-      +------------------------------+---------------------------------------------------+
-      | :cmacro:`PyBUF_INDIRECT`     | This flag indicates the returned buffer must have |
-      |                              | suboffsets information (which can be NULL if no   |
-      |                              | suboffsets are needed).  This can be used when    |
-      |                              | the consumer can handle indirect array            |
-      |                              | referencing implied by these suboffsets. This     |
-      |                              | implies :cmacro:`PyBUF_STRIDES`.                  |
-      |                              |                                                   |
-      |                              |                                                   |
-      |                              |                                                   |
-      +------------------------------+---------------------------------------------------+
-      | :cmacro:`PyBUF_FORMAT`       | The returned buffer must have true format         |
-      |                              | information if this flag is provided. This would  |
-      |                              | be used when the consumer is going to be checking |
-      |                              | for what 'kind' of data is actually stored. An    |
-      |                              | exporter should always be able to provide this    |
-      |                              | information if requested. If format is not        |
-      |                              | explicitly requested then the format must be      |
-      |                              | returned as *NULL* (which means ``'B'``, or       |
-      |                              | unsigned bytes)                                   |
-      +------------------------------+---------------------------------------------------+
-      | :cmacro:`PyBUF_STRIDED`      | This is equivalent to ``(PyBUF_STRIDES |          |
-      |                              | PyBUF_WRITABLE)``.                                |
-      +------------------------------+---------------------------------------------------+
-      | :cmacro:`PyBUF_STRIDED_RO`   | This is equivalent to ``(PyBUF_STRIDES)``.        |
-      |                              |                                                   |
-      +------------------------------+---------------------------------------------------+
-      | :cmacro:`PyBUF_RECORDS`      | This is equivalent to ``(PyBUF_STRIDES |          |
-      |                              | PyBUF_FORMAT | PyBUF_WRITABLE)``.                 |
-      +------------------------------+---------------------------------------------------+
-      | :cmacro:`PyBUF_RECORDS_RO`   | This is equivalent to ``(PyBUF_STRIDES |          |
-      |                              | PyBUF_FORMAT)``.                                  |
-      +------------------------------+---------------------------------------------------+
-      | :cmacro:`PyBUF_FULL`         | This is equivalent to ``(PyBUF_INDIRECT |         |
-      |                              | PyBUF_FORMAT | PyBUF_WRITABLE)``.                 |
-      +------------------------------+---------------------------------------------------+
-      | :cmacro:`PyBUF_FULL_RO`      | This is equivalent to ``(PyBUF_INDIRECT |         |
-      |                              | PyBUF_FORMAT)``.                                  |
-      +------------------------------+---------------------------------------------------+
-      | :cmacro:`PyBUF_CONTIG`       | This is equivalent to ``(PyBUF_ND |               |
-      |                              | PyBUF_WRITABLE)``.                                |
-      +------------------------------+---------------------------------------------------+
-      | :cmacro:`PyBUF_CONTIG_RO`    | This is equivalent to ``(PyBUF_ND)``.             |
-      |                              |                                                   |
-      +------------------------------+---------------------------------------------------+
+      +-------------------------------+---------------------------------------------------+
+      | Flag                          | Description                                       |
+      +===============================+===================================================+
+      | :c:macro:`PyBUF_SIMPLE`       | This is the default flag state.  The returned     |
+      |                               | buffer may or may not have writable memory.  The  |
+      |                               | format of the data will be assumed to be unsigned |
+      |                               | bytes.  This is a "stand-alone" flag constant. It |
+      |                               | never needs to be '|'d to the others. The exporter|
+      |                               | will raise an error if it cannot provide such a   |
+      |                               | contiguous buffer of bytes.                       |
+      |                               |                                                   |
+      +-------------------------------+---------------------------------------------------+
+      | :c:macro:`PyBUF_WRITABLE`     | The returned buffer must be writable.  If it is   |
+      |                               | not writable, then raise an error.                |
+      +-------------------------------+---------------------------------------------------+
+      | :c:macro:`PyBUF_STRIDES`      | This implies :c:macro:`PyBUF_ND`. The returned    |
+      |                               | buffer must provide strides information (i.e. the |
+      |                               | strides cannot be NULL). This would be used when  |
+      |                               | the consumer can handle strided, discontiguous    |
+      |                               | arrays.  Handling strides automatically assumes   |
+      |                               | you can handle shape.  The exporter can raise an  |
+      |                               | error if a strided representation of the data is  |
+      |                               | not possible (i.e. without the suboffsets).       |
+      |                               |                                                   |
+      +-------------------------------+---------------------------------------------------+
+      | :c:macro:`PyBUF_ND`           | The returned buffer must provide shape            |
+      |                               | information. The memory will be assumed C-style   |
+      |                               | contiguous (last dimension varies the             |
+      |                               | fastest). The exporter may raise an error if it   |
+      |                               | cannot provide this kind of contiguous buffer. If |
+      |                               | this is not given then shape will be *NULL*.      |
+      |                               |                                                   |
+      |                               |                                                   |
+      |                               |                                                   |
+      +-------------------------------+---------------------------------------------------+
+      |:c:macro:`PyBUF_C_CONTIGUOUS`  | These flags indicate that the contiguity returned |
+      |:c:macro:`PyBUF_F_CONTIGUOUS`  | buffer must be respectively, C-contiguous (last   |
+      |:c:macro:`PyBUF_ANY_CONTIGUOUS`| dimension varies the fastest), Fortran contiguous |
+      |                               | (first dimension varies the fastest) or either    |
+      |                               | one.  All of these flags imply                    |
+      |                               | :c:macro:`PyBUF_STRIDES` and guarantee that the   |
+      |                               | strides buffer info structure will be filled in   |
+      |                               | correctly.                                        |
+      |                               |                                                   |
+      +-------------------------------+---------------------------------------------------+
+      | :c:macro:`PyBUF_INDIRECT`     | This flag indicates the returned buffer must have |
+      |                               | suboffsets information (which can be NULL if no   |
+      |                               | suboffsets are needed).  This can be used when    |
+      |                               | the consumer can handle indirect array            |
+      |                               | referencing implied by these suboffsets. This     |
+      |                               | implies :c:macro:`PyBUF_STRIDES`.                 |
+      |                               |                                                   |
+      |                               |                                                   |
+      |                               |                                                   |
+      +-------------------------------+---------------------------------------------------+
+      | :c:macro:`PyBUF_FORMAT`       | The returned buffer must have true format         |
+      |                               | information if this flag is provided. This would  |
+      |                               | be used when the consumer is going to be checking |
+      |                               | for what 'kind' of data is actually stored. An    |
+      |                               | exporter should always be able to provide this    |
+      |                               | information if requested. If format is not        |
+      |                               | explicitly requested then the format must be      |
+      |                               | returned as *NULL* (which means ``'B'``, or       |
+      |                               | unsigned bytes)                                   |
+      +-------------------------------+---------------------------------------------------+
+      | :c:macro:`PyBUF_STRIDED`      | This is equivalent to ``(PyBUF_STRIDES |          |
+      |                               | PyBUF_WRITABLE)``.                                |
+      +-------------------------------+---------------------------------------------------+
+      | :c:macro:`PyBUF_STRIDED_RO`   | This is equivalent to ``(PyBUF_STRIDES)``.        |
+      |                               |                                                   |
+      +-------------------------------+---------------------------------------------------+
+      | :c:macro:`PyBUF_RECORDS`      | This is equivalent to ``(PyBUF_STRIDES |          |
+      |                               | PyBUF_FORMAT | PyBUF_WRITABLE)``.                 |
+      +-------------------------------+---------------------------------------------------+
+      | :c:macro:`PyBUF_RECORDS_RO`   | This is equivalent to ``(PyBUF_STRIDES |          |
+      |                               | PyBUF_FORMAT)``.                                  |
+      +-------------------------------+---------------------------------------------------+
+      | :c:macro:`PyBUF_FULL`         | This is equivalent to ``(PyBUF_INDIRECT |         |
+      |                               | PyBUF_FORMAT | PyBUF_WRITABLE)``.                 |
+      +-------------------------------+---------------------------------------------------+
+      | :c:macro:`PyBUF_FULL_RO`      | This is equivalent to ``(PyBUF_INDIRECT |         |
+      |                               | PyBUF_FORMAT)``.                                  |
+      +-------------------------------+---------------------------------------------------+
+      | :c:macro:`PyBUF_CONTIG`       | This is equivalent to ``(PyBUF_ND |               |
+      |                               | PyBUF_WRITABLE)``.                                |
+      +-------------------------------+---------------------------------------------------+
+      | :c:macro:`PyBUF_CONTIG_RO`    | This is equivalent to ``(PyBUF_ND)``.             |
+      |                               |                                                   |
+      +-------------------------------+---------------------------------------------------+
 
 
-.. cfunction:: void PyBuffer_Release(Py_buffer *view)
+.. c:function:: void PyBuffer_Release(Py_buffer *view)
 
    Release the buffer *view*.  This should be called when the buffer
    is no longer being used as it may free memory from it.
 
 
-.. cfunction:: Py_ssize_t PyBuffer_SizeFromFormat(const char *)
+.. c:function:: Py_ssize_t PyBuffer_SizeFromFormat(const char *)
 
-   Return the implied :cdata:`~Py_buffer.itemsize` from the struct-stype
-   :cdata:`~Py_buffer.format`.
+   Return the implied :c:data:`~Py_buffer.itemsize` from the struct-stype
+   :c:data:`~Py_buffer.format`.
 
 
-.. cfunction:: int PyBuffer_IsContiguous(Py_buffer *view, char fortran)
+.. c:function:: int PyBuffer_IsContiguous(Py_buffer *view, char fortran)
 
    Return 1 if the memory defined by the *view* is C-style (*fortran* is
    ``'C'``) or Fortran-style (*fortran* is ``'F'``) contiguous or either one
    (*fortran* is ``'A'``).  Return 0 otherwise.
 
 
-.. cfunction:: void PyBuffer_FillContiguousStrides(int ndim, Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t itemsize, char fortran)
+.. c:function:: void PyBuffer_FillContiguousStrides(int ndim, Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t itemsize, char fortran)
 
    Fill the *strides* array with byte-strides of a contiguous (C-style if
    *fortran* is ``'C'`` or Fortran-style if *fortran* is ``'F'``) array of the
    given shape with the given number of bytes per element.
 
 
-.. cfunction:: int PyBuffer_FillInfo(Py_buffer *view, PyObject *obj, void *buf, Py_ssize_t len, int readonly, int infoflags)
+.. c:function:: int PyBuffer_FillInfo(Py_buffer *view, PyObject *obj, void *buf, Py_ssize_t len, int readonly, int infoflags)
 
    Fill in a buffer-info structure, *view*, correctly for an exporter that can
    only share a contiguous chunk of memory of "unsigned bytes" of the given
 A :class:`memoryview` object exposes the new C level buffer interface as a
 Python object which can then be passed around like any other object.
 
-.. cfunction:: PyObject *PyMemoryView_FromObject(PyObject *obj)
+.. c:function:: PyObject *PyMemoryView_FromObject(PyObject *obj)
 
    Create a memoryview object from an object that defines the new buffer
    interface.
 
 
-.. cfunction:: PyObject *PyMemoryView_FromBuffer(Py_buffer *view)
+.. c:function:: PyObject *PyMemoryView_FromBuffer(Py_buffer *view)
 
    Create a memoryview object wrapping the given buffer-info structure *view*.
    The memoryview object then owns the buffer, which means you shouldn't
    memoryview object.
 
 
-.. cfunction:: PyObject *PyMemoryView_GetContiguous(PyObject *obj, int buffertype, char order)
+.. c:function:: PyObject *PyMemoryView_GetContiguous(PyObject *obj, int buffertype, char order)
 
    Create a memoryview object to a contiguous chunk of memory (in either
    'C' or 'F'ortran *order*) from an object that defines the buffer
    new bytes object.
 
 
-.. cfunction:: int PyMemoryView_Check(PyObject *obj)
+.. c:function:: int PyMemoryView_Check(PyObject *obj)
 
    Return true if the object *obj* is a memoryview object.  It is not
    currently allowed to create subclasses of :class:`memoryview`.
 
 
-.. cfunction:: Py_buffer *PyMemoryView_GET_BUFFER(PyObject *obj)
+.. c:function:: Py_buffer *PyMemoryView_GET_BUFFER(PyObject *obj)
 
    Return a pointer to the buffer-info structure wrapped by the given
    object.  The object **must** be a memoryview instance; this macro doesn't
 .. index:: single: PyBufferProcs
 
 More information on the old buffer interface is provided in the section
-:ref:`buffer-structs`, under the description for :ctype:`PyBufferProcs`.
+:ref:`buffer-structs`, under the description for :c:type:`PyBufferProcs`.
 
 A "buffer object" is defined in the :file:`bufferobject.h` header (included by
 :file:`Python.h`). These objects look very similar to string objects at the
 native, in-memory format.
 
 
-.. ctype:: PyBufferObject
+.. c:type:: PyBufferObject
 
-   This subtype of :ctype:`PyObject` represents a buffer object.
+   This subtype of :c:type:`PyObject` represents a buffer object.
 
 
-.. cvar:: PyTypeObject PyBuffer_Type
+.. c:var:: PyTypeObject PyBuffer_Type
 
    .. index:: single: BufferType (in module types)
 
-   The instance of :ctype:`PyTypeObject` which represents the Python buffer type;
+   The instance of :c:type:`PyTypeObject` which represents the Python buffer type;
    it is the same object as ``buffer`` and  ``types.BufferType`` in the Python
    layer. .
 
 
-.. cvar:: int Py_END_OF_BUFFER
+.. c:var:: int Py_END_OF_BUFFER
 
    This constant may be passed as the *size* parameter to
-   :cfunc:`PyBuffer_FromObject` or :cfunc:`PyBuffer_FromReadWriteObject`.  It
-   indicates that the new :ctype:`PyBufferObject` should refer to *base*
+   :c:func:`PyBuffer_FromObject` or :c:func:`PyBuffer_FromReadWriteObject`.  It
+   indicates that the new :c:type:`PyBufferObject` should refer to *base*
    object from the specified *offset* to the end of its exported buffer.
    Using this enables the caller to avoid querying the *base* object for its
    length.
 
 
-.. cfunction:: int PyBuffer_Check(PyObject *p)
+.. c:function:: int PyBuffer_Check(PyObject *p)
 
-   Return true if the argument has type :cdata:`PyBuffer_Type`.
+   Return true if the argument has type :c:data:`PyBuffer_Type`.
 
 
-.. cfunction:: PyObject* PyBuffer_FromObject(PyObject *base, Py_ssize_t offset, Py_ssize_t size)
+.. c:function:: PyObject* PyBuffer_FromObject(PyObject *base, Py_ssize_t offset, Py_ssize_t size)
 
    Return a new read-only buffer object.  This raises :exc:`TypeError` if
    *base* doesn't support the read-only buffer protocol or doesn't provide
    length of the *base* object's exported buffer data.
 
    .. versionchanged:: 2.5
-      This function used an :ctype:`int` type for *offset* and *size*. This
+      This function used an :c:type:`int` type for *offset* and *size*. This
       might require changes in your code for properly supporting 64-bit
       systems.
 
 
-.. cfunction:: PyObject* PyBuffer_FromReadWriteObject(PyObject *base, Py_ssize_t offset, Py_ssize_t size)
+.. c:function:: PyObject* PyBuffer_FromReadWriteObject(PyObject *base, Py_ssize_t offset, Py_ssize_t size)
 
    Return a new writable buffer object.  Parameters and exceptions are similar
-   to those for :cfunc:`PyBuffer_FromObject`.  If the *base* object does not
+   to those for :c:func:`PyBuffer_FromObject`.  If the *base* object does not
    export the writeable buffer protocol, then :exc:`TypeError` is raised.
 
    .. versionchanged:: 2.5
-      This function used an :ctype:`int` type for *offset* and *size*. This
+      This function used an :c:type:`int` type for *offset* and *size*. This
       might require changes in your code for properly supporting 64-bit
       systems.
 
 
-.. cfunction:: PyObject* PyBuffer_FromMemory(void *ptr, Py_ssize_t size)
+.. c:function:: PyObject* PyBuffer_FromMemory(void *ptr, Py_ssize_t size)
 
    Return a new read-only buffer object that reads from a specified location
    in memory, with a specified size.  The caller is responsible for ensuring
    *size* parameter; :exc:`ValueError` will be raised in that case.
 
    .. versionchanged:: 2.5
-      This function used an :ctype:`int` type for *size*. This might require
+      This function used an :c:type:`int` type for *size*. This might require
       changes in your code for properly supporting 64-bit systems.
 
 
-.. cfunction:: PyObject* PyBuffer_FromReadWriteMemory(void *ptr, Py_ssize_t size)
+.. c:function:: PyObject* PyBuffer_FromReadWriteMemory(void *ptr, Py_ssize_t size)
 
-   Similar to :cfunc:`PyBuffer_FromMemory`, but the returned buffer is
+   Similar to :c:func:`PyBuffer_FromMemory`, but the returned buffer is
    writable.
 
    .. versionchanged:: 2.5
-      This function used an :ctype:`int` type for *size*. This might require
+      This function used an :c:type:`int` type for *size*. This might require
       changes in your code for properly supporting 64-bit systems.
 
 
-.. cfunction:: PyObject* PyBuffer_New(Py_ssize_t size)
+.. c:function:: PyObject* PyBuffer_New(Py_ssize_t size)
 
    Return a new writable buffer object that maintains its own memory buffer of
    *size* bytes.  :exc:`ValueError` is returned if *size* is not zero or
    positive.  Note that the memory buffer (as returned by
-   :cfunc:`PyObject_AsWriteBuffer`) is not specifically aligned.
+   :c:func:`PyObject_AsWriteBuffer`) is not specifically aligned.
 
    .. versionchanged:: 2.5
-      This function used an :ctype:`int` type for *size*. This might require
+      This function used an :c:type:`int` type for *size*. This might require
       changes in your code for properly supporting 64-bit systems.

Doc/c-api/bytearray.rst

 .. versionadded:: 2.6
 
 
-.. ctype:: PyByteArrayObject
+.. c:type:: PyByteArrayObject
 
-   This subtype of :ctype:`PyObject` represents a Python bytearray object.
+   This subtype of :c:type:`PyObject` represents a Python bytearray object.
 
 
-.. cvar:: PyTypeObject PyByteArray_Type
+.. c:var:: PyTypeObject PyByteArray_Type
 
-   This instance of :ctype:`PyTypeObject` represents the Python bytearray type;
+   This instance of :c:type:`PyTypeObject` represents the Python bytearray type;
    it is the same object as ``bytearray`` in the Python layer.
 
 Type check macros
 ^^^^^^^^^^^^^^^^^
 
-.. cfunction:: int PyByteArray_Check(PyObject *o)
+.. c:function:: int PyByteArray_Check(PyObject *o)
 
    Return true if the object *o* is a bytearray object or an instance of a
    subtype of the bytearray type.
 
 
-.. cfunction:: int PyByteArray_CheckExact(PyObject *o)
+.. c:function:: int PyByteArray_CheckExact(PyObject *o)
 
    Return true if the object *o* is a bytearray object, but not an instance of a
    subtype of the bytearray type.
 Direct API functions
 ^^^^^^^^^^^^^^^^^^^^
 
-.. cfunction:: PyObject* PyByteArray_FromObject(PyObject *o)
+.. c:function:: PyObject* PyByteArray_FromObject(PyObject *o)
 
    Return a new bytearray object from any object, *o*, that implements the
    buffer protocol.
    .. XXX expand about the buffer protocol, at least somewhere
 
 
-.. cfunction:: PyObject* PyByteArray_FromStringAndSize(const char *string, Py_ssize_t len)
+.. c:function:: PyObject* PyByteArray_FromStringAndSize(const char *string, Py_ssize_t len)
 
    Create a new bytearray object from *string* and its length, *len*.  On
    failure, *NULL* is returned.
 
 
-.. cfunction:: PyObject* PyByteArray_Concat(PyObject *a, PyObject *b)
+.. c:function:: PyObject* PyByteArray_Concat(PyObject *a, PyObject *b)
 
    Concat bytearrays *a* and *b* and return a new bytearray with the result.
 
 
-.. cfunction:: Py_ssize_t PyByteArray_Size(PyObject *bytearray)
+.. c:function:: Py_ssize_t PyByteArray_Size(PyObject *bytearray)
 
    Return the size of *bytearray* after checking for a *NULL* pointer.
 
 
-.. cfunction:: char* PyByteArray_AsString(PyObject *bytearray)
+.. c:function:: char* PyByteArray_AsString(PyObject *bytearray)
 
    Return the contents of *bytearray* as a char array after checking for a
    *NULL* pointer.
 
 
-.. cfunction:: int PyByteArray_Resize(PyObject *bytearray, Py_ssize_t len)
+.. c:function:: int PyByteArray_Resize(PyObject *bytearray, Py_ssize_t len)
 
    Resize the internal buffer of *bytearray* to *len*.
 
 
 These macros trade safety for speed and they don't check pointers.
 
-.. cfunction:: char* PyByteArray_AS_STRING(PyObject *bytearray)
+.. c:function:: char* PyByteArray_AS_STRING(PyObject *bytearray)
 
-   Macro version of :cfunc:`PyByteArray_AsString`.
+   Macro version of :c:func:`PyByteArray_AsString`.
 
 
-.. cfunction:: Py_ssize_t PyByteArray_GET_SIZE(PyObject *bytearray)
+.. c:function:: Py_ssize_t PyByteArray_GET_SIZE(PyObject *bytearray)
 
-   Macro version of :cfunc:`PyByteArray_Size`.
+   Macro version of :c:func:`PyByteArray_Size`.

Doc/c-api/capsule.rst

 Refer to :ref:`using-capsules` for more information on using these objects.
 
 
-.. ctype:: PyCapsule
+.. c:type:: PyCapsule
 
-   This subtype of :ctype:`PyObject` represents an opaque value, useful for C
-   extension modules who need to pass an opaque value (as a :ctype:`void\*`
+   This subtype of :c:type:`PyObject` represents an opaque value, useful for C
+   extension modules who need to pass an opaque value (as a :c:type:`void\*`
    pointer) through Python code to other C code.  It is often used to make a C
    function pointer defined in one module available to other modules, so the
    regular import mechanism can be used to access C APIs defined in dynamically
    loaded modules.
 
-.. ctype:: PyCapsule_Destructor
+.. c:type:: PyCapsule_Destructor
 
    The type of a destructor callback for a capsule.  Defined as::
 
       typedef void (*PyCapsule_Destructor)(PyObject *);
 
-   See :cfunc:`PyCapsule_New` for the semantics of PyCapsule_Destructor
+   See :c:func:`PyCapsule_New` for the semantics of PyCapsule_Destructor
    callbacks.
 
 
-.. cfunction:: int PyCapsule_CheckExact(PyObject *p)
+.. c:function:: int PyCapsule_CheckExact(PyObject *p)
 
-   Return true if its argument is a :ctype:`PyCapsule`.
+   Return true if its argument is a :c:type:`PyCapsule`.
 
 
-.. cfunction:: PyObject* PyCapsule_New(void *pointer, const char *name, PyCapsule_Destructor destructor)
+.. c:function:: PyObject* PyCapsule_New(void *pointer, const char *name, PyCapsule_Destructor destructor)
 
-   Create a :ctype:`PyCapsule` encapsulating the *pointer*.  The *pointer*
+   Create a :c:type:`PyCapsule` encapsulating the *pointer*.  The *pointer*
    argument may not be *NULL*.
 
    On failure, set an exception and return *NULL*.
 
    If this capsule will be stored as an attribute of a module, the *name* should
    be specified as ``modulename.attributename``.  This will enable other modules
-   to import the capsule using :cfunc:`PyCapsule_Import`.
+   to import the capsule using :c:func:`PyCapsule_Import`.
 
 
-.. cfunction:: void* PyCapsule_GetPointer(PyObject *capsule, const char *name)
+.. c:function:: void* PyCapsule_GetPointer(PyObject *capsule, const char *name)
 
    Retrieve the *pointer* stored in the capsule.  On failure, set an exception
    and return *NULL*.
 
    The *name* parameter must compare exactly to the name stored in the capsule.
    If the name stored in the capsule is *NULL*, the *name* passed in must also
-   be *NULL*.  Python uses the C function :cfunc:`strcmp` to compare capsule
+   be *NULL*.  Python uses the C function :c:func:`strcmp` to compare capsule
    names.
 
 
-.. cfunction:: PyCapsule_Destructor PyCapsule_GetDestructor(PyObject *capsule)
+.. c:function:: PyCapsule_Destructor PyCapsule_GetDestructor(PyObject *capsule)
 
    Return the current destructor stored in the capsule.  On failure, set an
    exception and return *NULL*.
 
    It is legal for a capsule to have a *NULL* destructor.  This makes a *NULL*
-   return code somewhat ambiguous; use :cfunc:`PyCapsule_IsValid` or
-   :cfunc:`PyErr_Occurred` to disambiguate.
+   return code somewhat ambiguous; use :c:func:`PyCapsule_IsValid` or
+   :c:func:`PyErr_Occurred` to disambiguate.
 
 
-.. cfunction:: void* PyCapsule_GetContext(PyObject *capsule)
+.. c:function:: void* PyCapsule_GetContext(PyObject *capsule)
 
    Return the current context stored in the capsule.  On failure, set an
    exception and return *NULL*.
 
    It is legal for a capsule to have a *NULL* context.  This makes a *NULL*
-   return code somewhat ambiguous; use :cfunc:`PyCapsule_IsValid` or
-   :cfunc:`PyErr_Occurred` to disambiguate.
+   return code somewhat ambiguous; use :c:func:`PyCapsule_IsValid` or
+   :c:func:`PyErr_Occurred` to disambiguate.
 
 
-.. cfunction:: const char* PyCapsule_GetName(PyObject *capsule)
+.. c:function:: const char* PyCapsule_GetName(PyObject *capsule)
 
    Return the current name stored in the capsule.  On failure, set an exception
    and return *NULL*.
 
    It is legal for a capsule to have a *NULL* name.  This makes a *NULL* return
-   code somewhat ambiguous; use :cfunc:`PyCapsule_IsValid` or
-   :cfunc:`PyErr_Occurred` to disambiguate.
+   code somewhat ambiguous; use :c:func:`PyCapsule_IsValid` or
+   :c:func:`PyErr_Occurred` to disambiguate.
 
 
-.. cfunction:: void* PyCapsule_Import(const char *name, int no_block)
+.. c:function:: void* PyCapsule_Import(const char *name, int no_block)
 
    Import a pointer to a C object from a capsule attribute in a module.  The
    *name* parameter should specify the full name to the attribute, as in
    ``module.attribute``.  The *name* stored in the capsule must match this
    string exactly.  If *no_block* is true, import the module without blocking
-   (using :cfunc:`PyImport_ImportModuleNoBlock`).  If *no_block* is false,
-   import the module conventionally (using :cfunc:`PyImport_ImportModule`).
+   (using :c:func:`PyImport_ImportModuleNoBlock`).  If *no_block* is false,
+   import the module conventionally (using :c:func:`PyImport_ImportModule`).
 
    Return the capsule's internal *pointer* on success.  On failure, set an
-   exception and return *NULL*.  However, if :cfunc:`PyCapsule_Import` failed to
+   exception and return *NULL*.  However, if :c:func:`PyCapsule_Import` failed to
    import the module, and *no_block* was true, no exception is set.
 
-.. cfunction:: int PyCapsule_IsValid(PyObject *capsule, const char *name)
+.. c:function:: int PyCapsule_IsValid(PyObject *capsule, const char *name)
 
    Determines whether or not *capsule* is a valid capsule.  A valid capsule is
-   non-*NULL*, passes :cfunc:`PyCapsule_CheckExact`, has a non-*NULL* pointer
+   non-*NULL*, passes :c:func:`PyCapsule_CheckExact`, has a non-*NULL* pointer
    stored in it, and its internal name matches the *name* parameter.  (See
-   :cfunc:`PyCapsule_GetPointer` for information on how capsule names are
+   :c:func:`PyCapsule_GetPointer` for information on how capsule names are
    compared.)
 
-   In other words, if :cfunc:`PyCapsule_IsValid` returns a true value, calls to
-   any of the accessors (any function starting with :cfunc:`PyCapsule_Get`) are
+   In other words, if :c:func:`PyCapsule_IsValid` returns a true value, calls to
+   any of the accessors (any function starting with :c:func:`PyCapsule_Get`) are
    guaranteed to succeed.
 
    Return a nonzero value if the object is valid and matches the name passed in.
    Return 0 otherwise.  This function will not fail.
 
-.. cfunction:: int PyCapsule_SetContext(PyObject *capsule, void *context)
+.. c:function:: int PyCapsule_SetContext(PyObject *capsule, void *context)
 
    Set the context pointer inside *capsule* to *context*.
 
    Return 0 on success.  Return nonzero and set an exception on failure.
 
-.. cfunction:: int PyCapsule_SetDestructor(PyObject *capsule, PyCapsule_Destructor destructor)
+.. c:function:: int PyCapsule_SetDestructor(PyObject *capsule, PyCapsule_Destructor destructor)
 
    Set the destructor inside *capsule* to *destructor*.
 
    Return 0 on success.  Return nonzero and set an exception on failure.
 
-.. cfunction:: int PyCapsule_SetName(PyObject *capsule, const char *name)
+.. c:function:: int PyCapsule_SetName(PyObject *capsule, const char *name)
 
    Set the name inside *capsule* to *name*.  If non-*NULL*, the name must
    outlive the capsule.  If the previous *name* stored in the capsule was not
 
    Return 0 on success.  Return nonzero and set an exception on failure.
 
-.. cfunction:: int PyCapsule_SetPointer(PyObject *capsule, void *pointer)
+.. c:function:: int PyCapsule_SetPointer(PyObject *capsule, void *pointer)
 
    Set the void pointer inside *capsule* to *pointer*.  The pointer may not be
    *NULL*.

Doc/c-api/cell.rst

 Cell objects are not likely to be useful elsewhere.
 
 
-.. ctype:: PyCellObject
+.. c:type:: PyCellObject
 
    The C structure used for cell objects.
 
 
-.. cvar:: PyTypeObject PyCell_Type
+.. c:var:: PyTypeObject PyCell_Type
 
    The type object corresponding to cell objects.
 
 
-.. cfunction:: int PyCell_Check(ob)
+.. c:function:: int PyCell_Check(ob)
 
    Return true if *ob* is a cell object; *ob* must not be *NULL*.
 
 
-.. cfunction:: PyObject* PyCell_New(PyObject *ob)
+.. c:function:: PyObject* PyCell_New(PyObject *ob)
 
    Create and return a new cell object containing the value *ob*. The parameter may
    be *NULL*.
 
 
-.. cfunction:: PyObject* PyCell_Get(PyObject *cell)
+.. c:function:: PyObject* PyCell_Get(PyObject *cell)
 
    Return the contents of the cell *cell*.
 
 
-.. cfunction:: PyObject* PyCell_GET(PyObject *cell)
+.. c:function:: PyObject* PyCell_GET(PyObject *cell)
 
    Return the contents of the cell *cell*, but without checking that *cell* is
    non-*NULL* and a cell object.
 
 
-.. cfunction:: int PyCell_Set(PyObject *cell, PyObject *value)
+.. c:function:: int PyCell_Set(PyObject *cell, PyObject *value)
 
    Set the contents of the cell object *cell* to *value*.  This releases the
    reference to any current content of the cell. *value* may be *NULL*.  *cell*
    success, ``0`` will be returned.
 
 
-.. cfunction:: void PyCell_SET(PyObject *cell, PyObject *value)
+.. c:function:: void PyCell_SET(PyObject *cell, PyObject *value)
 
    Sets the value of the cell object *cell* to *value*.  No reference counts are
    adjusted, and no checks are made for safety; *cell* must be non-*NULL* and must

Doc/c-api/class.rst

 will want to work with type objects (section :ref:`typeobjects`).
 
 
-.. ctype:: PyClassObject
+.. c:type:: PyClassObject
 
    The C structure of the objects used to describe built-in classes.
 
 
-.. cvar:: PyObject* PyClass_Type
+.. c:var:: PyObject* PyClass_Type
 
    .. index:: single: ClassType (in module types)
 
    ``types.ClassType`` in the Python layer.
 
 
-.. cfunction:: int PyClass_Check(PyObject *o)
+.. c:function:: int PyClass_Check(PyObject *o)
 
    Return true if the object *o* is a class object, including instances of types
    derived from the standard class object.  Return false in all other cases.
 
 
-.. cfunction:: int PyClass_IsSubclass(PyObject *klass, PyObject *base)
+.. c:function:: int PyClass_IsSubclass(PyObject *klass, PyObject *base)
 
    Return true if *klass* is a subclass of *base*. Return false in all other cases.
 
 There are very few functions specific to instance objects.
 
 
-.. cvar:: PyTypeObject PyInstance_Type
+.. c:var:: PyTypeObject PyInstance_Type
 
    Type object for class instances.
 
 
-.. cfunction:: int PyInstance_Check(PyObject *obj)
+.. c:function:: int PyInstance_Check(PyObject *obj)
 
    Return true if *obj* is an instance.
 
 
-.. cfunction:: PyObject* PyInstance_New(PyObject *class, PyObject *arg, PyObject *kw)
+.. c:function:: PyObject* PyInstance_New(PyObject *class, PyObject *arg, PyObject *kw)
 
    Create a new instance of a specific class.  The parameters *arg* and *kw* are
    used as the positional and keyword parameters to the object's constructor.
 
 
-.. cfunction:: PyObject* PyInstance_NewRaw(PyObject *class, PyObject *dict)
+.. c:function:: PyObject* PyInstance_NewRaw(PyObject *class, PyObject *dict)
 
    Create a new instance of a specific class without calling its constructor.
    *class* is the class of new object.  The *dict* parameter will be used as the

Doc/c-api/cobject.rst

    The CObject API is deprecated as of Python 2.7.  Please switch to the new
    :ref:`capsules` API.
 
-.. ctype:: PyCObject
+.. c:type:: PyCObject
 
-   This subtype of :ctype:`PyObject` represents an opaque value, useful for C
-   extension modules who need to pass an opaque value (as a :ctype:`void\*`
+   This subtype of :c:type:`PyObject` represents an opaque value, useful for C
+   extension modules who need to pass an opaque value (as a :c:type:`void\*`
    pointer) through Python code to other C code.  It is often used to make a C
    function pointer defined in one module available to other modules, so the
    regular import mechanism can be used to access C APIs defined in dynamically
    loaded modules.
 
 
-.. cfunction:: int PyCObject_Check(PyObject *p)
+.. c:function:: int PyCObject_Check(PyObject *p)
 
-   Return true if its argument is a :ctype:`PyCObject`.
+   Return true if its argument is a :c:type:`PyCObject`.
 
 
-.. cfunction:: PyObject* PyCObject_FromVoidPtr(void* cobj, void (*destr)(void *))
+.. c:function:: PyObject* PyCObject_FromVoidPtr(void* cobj, void (*destr)(void *))
 
-   Create a :ctype:`PyCObject` from the ``void *`` *cobj*.  The *destr* function
+   Create a :c:type:`PyCObject` from the ``void *`` *cobj*.  The *destr* function
    will be called when the object is reclaimed, unless it is *NULL*.
 
 
-.. cfunction:: PyObject* PyCObject_FromVoidPtrAndDesc(void* cobj, void* desc, void (*destr)(void *, void *))
+.. c:function:: PyObject* PyCObject_FromVoidPtrAndDesc(void* cobj, void* desc, void (*destr)(void *, void *))
 
-   Create a :ctype:`PyCObject` from the :ctype:`void \*` *cobj*.  The *destr*
+   Create a :c:type:`PyCObject` from the :c:type:`void \*` *cobj*.  The *destr*
    function will be called when the object is reclaimed. The *desc* argument can
    be used to pass extra callback data for the destructor function.
 
 
-.. cfunction:: void* PyCObject_AsVoidPtr(PyObject* self)
+.. c:function:: void* PyCObject_AsVoidPtr(PyObject* self)
 
-   Return the object :ctype:`void \*` that the :ctype:`PyCObject` *self* was
+   Return the object :c:type:`void \*` that the :c:type:`PyCObject` *self* was
    created with.
 
 
-.. cfunction:: void* PyCObject_GetDesc(PyObject* self)
+.. c:function:: void* PyCObject_GetDesc(PyObject* self)
 
-   Return the description :ctype:`void \*` that the :ctype:`PyCObject` *self* was
+   Return the description :c:type:`void \*` that the :c:type:`PyCObject` *self* was
    created with.
 
 
-.. cfunction:: int PyCObject_SetVoidPtr(PyObject* self, void* cobj)
+.. c:function:: int PyCObject_SetVoidPtr(PyObject* self, void* cobj)
 
-   Set the void pointer inside *self* to *cobj*. The :ctype:`PyCObject` must not
+   Set the void pointer inside *self* to *cobj*. The :c:type:`PyCObject` must not
    have an associated destructor. Return true on success, false on failure.

Doc/c-api/code.rst

 Each one represents a chunk of executable code that hasn't yet been
 bound into a function.
 
-.. ctype:: PyCodeObject
+.. c:type:: PyCodeObject
 
    The C structure of the objects used to describe code objects.  The
    fields of this type are subject to change at any time.
 
 
-.. cvar:: PyTypeObject PyCode_Type
+.. c:var:: PyTypeObject PyCode_Type
 
-   This is an instance of :ctype:`PyTypeObject` representing the Python
+   This is an instance of :c:type:`PyTypeObject` representing the Python
    :class:`code` type.
 
 
-.. cfunction:: int PyCode_Check(PyObject *co)
+.. c:function:: int PyCode_Check(PyObject *co)
 
    Return true if *co* is a :class:`code` object
 
-.. cfunction:: int PyCode_GetNumFree(PyObject *co)
+.. c:function:: int PyCode_GetNumFree(PyObject *co)
 
    Return the number of free variables in *co*.
 
-.. cfunction:: PyCodeObject *PyCode_New(int argcount, int nlocals, int stacksize, int flags, PyObject *code, PyObject *consts, PyObject *names, PyObject *varnames, PyObject *freevars, PyObject *cellvars, PyObject *filename, PyObject *name, int firstlineno, PyObject *lnotab)
+.. c:function:: PyCodeObject *PyCode_New(int argcount, int nlocals, int stacksize, int flags, PyObject *code, PyObject *consts, PyObject *names, PyObject *varnames, PyObject *freevars, PyObject *cellvars, PyObject *filename, PyObject *name, int firstlineno, PyObject *lnotab)
 
    Return a new code object.  If you need a dummy code object to
-   create a frame, use :cfunc:`PyCode_NewEmpty` instead.  Calling
-   :cfunc:`PyCode_New` directly can bind you to a precise Python
+   create a frame, use :c:func:`PyCode_NewEmpty` instead.  Calling
+   :c:func:`PyCode_New` directly can bind you to a precise Python
    version since the definition of the bytecode changes often.
 
 
-.. cfunction:: int PyCode_NewEmpty(const char *filename, const char *funcname, int firstlineno)
+.. c:function:: int PyCode_NewEmpty(const char *filename, const char *funcname, int firstlineno)
 
    Return a new empty code object with the specified filename,
    function name, and first line number.  It is illegal to

Doc/c-api/codec.rst

 Codec registry and support functions
 ====================================
 
-.. cfunction:: int PyCodec_Register(PyObject *search_function)
+.. c:function:: int PyCodec_Register(PyObject *search_function)
 
    Register a new codec search function.
 
    As side effect, this tries to load the :mod:`encodings` package, if not yet
    done, to make sure that it is always first in the list of search functions.
 
-.. cfunction:: int PyCodec_KnownEncoding(const char *encoding)
+.. c:function:: int PyCodec_KnownEncoding(const char *encoding)
 
    Return ``1`` or ``0`` depending on whether there is a registered codec for
    the given *encoding*.
 
-.. cfunction:: PyObject* PyCodec_Encode(PyObject *object, const char *encoding, const char *errors)
+.. c:function:: PyObject* PyCodec_Encode(PyObject *object, const char *encoding, const char *errors)
 
    Generic codec based encoding API.
 
    be *NULL* to use the default method defined for the codec.  Raises a
    :exc:`LookupError` if no encoder can be found.
 
-.. cfunction:: PyObject* PyCodec_Decode(PyObject *object, const char *encoding, const char *errors)
+.. c:function:: PyObject* PyCodec_Decode(PyObject *object, const char *encoding, const char *errors)
 
    Generic codec based decoding API.
 
 effectively case-insensitive.  If no codec is found, a :exc:`KeyError` is set
 and *NULL* returned.
 
-.. cfunction:: PyObject* PyCodec_Encoder(const char *encoding)
+.. c:function:: PyObject* PyCodec_Encoder(const char *encoding)
 
    Get an encoder function for the given *encoding*.
 
-.. cfunction:: PyObject* PyCodec_Decoder(const char *encoding)
+.. c:function:: PyObject* PyCodec_Decoder(const char *encoding)
 
    Get a decoder function for the given *encoding*.
 
-.. cfunction:: PyObject* PyCodec_IncrementalEncoder(const char *encoding, const char *errors)
+.. c:function:: PyObject* PyCodec_IncrementalEncoder(const char *encoding, const char *errors)
 
    Get an :class:`IncrementalEncoder` object for the given *encoding*.
 
-.. cfunction:: PyObject* PyCodec_IncrementalDecoder(const char *encoding, const char *errors)
+.. c:function:: PyObject* PyCodec_IncrementalDecoder(const char *encoding, const char *errors)
 
    Get an :class:`IncrementalDecoder` object for the given *encoding*.
 
-.. cfunction:: PyObject* PyCodec_StreamReader(const char *encoding, PyObject *stream, const char *errors)
+.. c:function:: PyObject* PyCodec_StreamReader(const char *encoding, PyObject *stream, const char *errors)
 
    Get a :class:`StreamReader` factory function for the given *encoding*.
 
-.. cfunction:: PyObject* PyCodec_StreamWriter(const char *encoding, PyObject *stream, const char *errors)
+.. c:function:: PyObject* PyCodec_StreamWriter(const char *encoding, PyObject *stream, const char *errors)
 
    Get a :class:`StreamWriter` factory function for the given *encoding*.
 
 Registry API for Unicode encoding error handlers
 ------------------------------------------------
 
-.. cfunction:: int PyCodec_RegisterError(const char *name, PyObject *error)
+.. c:function:: int PyCodec_RegisterError(const char *name, PyObject *error)
 
    Register the error handling callback function *error* under the given *name*.
    This callback function will be called by a codec when it encounters
 
    Return ``0`` on success, ``-1`` on error.
 
-.. cfunction:: PyObject* PyCodec_LookupError(const char *name)
+.. c:function:: PyObject* PyCodec_LookupError(const char *name)
 
    Lookup the error handling callback function registered under *name*.  As a
    special case *NULL* can be passed, in which case the error handling callback
    for "strict" will be returned.
 
-.. cfunction:: PyObject* PyCodec_StrictErrors(PyObject *exc)
+.. c:function:: PyObject* PyCodec_StrictErrors(PyObject *exc)
 
    Raise *exc* as an exception.
 
-.. cfunction:: PyObject* PyCodec_IgnoreErrors(PyObject *exc)
+.. c:function:: PyObject* PyCodec_IgnoreErrors(PyObject *exc)
 
    Ignore the unicode error, skipping the faulty input.
 
-.. cfunction:: PyObject* PyCodec_ReplaceErrors(PyObject *exc)
+.. c:function:: PyObject* PyCodec_ReplaceErrors(PyObject *exc)
 
    Replace the unicode encode error with ``?`` or ``U+FFFD``.
 
-.. cfunction:: PyObject* PyCodec_XMLCharRefReplaceErrors(PyObject *exc)
+.. c:function:: PyObject* PyCodec_XMLCharRefReplaceErrors(PyObject *exc)
 
    Replace the unicode encode error with XML character references.
 
-.. cfunction:: PyObject* PyCodec_BackslashReplaceErrors(PyObject *exc)
+.. c:function:: PyObject* PyCodec_BackslashReplaceErrors(PyObject *exc)
 
    Replace the unicode encode error with backslash escapes (``\x``, ``\u`` and
    ``\U``).

Doc/c-api/complex.rst

 pointers.  This is consistent throughout the API.
 
 
-.. ctype:: Py_complex
+.. c:type:: Py_complex
 
    The C structure which corresponds to the value portion of a Python complex
    number object.  Most of the functions for dealing with complex number objects
       } Py_complex;
 
 
-.. cfunction:: Py_complex _Py_c_sum(Py_complex left, Py_complex right)
+.. c:function:: Py_complex _Py_c_sum(Py_complex left, Py_complex right)
 
-   Return the sum of two complex numbers, using the C :ctype:`Py_complex`
+   Return the sum of two complex numbers, using the C :c:type:`Py_complex`
    representation.
 
 
-.. cfunction:: Py_complex _Py_c_diff(Py_complex left, Py_complex right)
+.. c:function:: Py_complex _Py_c_diff(Py_complex left, Py_complex right)
 
    Return the difference between two complex numbers, using the C
-   :ctype:`Py_complex` representation.
+   :c:type:`Py_complex` representation.
 
 
-.. cfunction:: Py_complex _Py_c_neg(Py_complex complex)
+.. c:function:: Py_complex _Py_c_neg(Py_complex complex)
 
    Return the negation of the complex number *complex*, using the C
-   :ctype:`Py_complex` representation.
+   :c:type:`Py_complex` representation.
 
 
-.. cfunction:: Py_complex _Py_c_prod(Py_complex left, Py_complex right)
+.. c:function:: Py_complex _Py_c_prod(Py_complex left, Py_complex right)
 
-   Return the product of two complex numbers, using the C :ctype:`Py_complex`
+   Return the product of two complex numbers, using the C :c:type:`Py_complex`
    representation.
 
 
-.. cfunction:: Py_complex _Py_c_quot(Py_complex dividend, Py_complex divisor)
+.. c:function:: Py_complex _Py_c_quot(Py_complex dividend, Py_complex divisor)
 
-   Return the quotient of two complex numbers, using the C :ctype:`Py_complex`
+   Return the quotient of two complex numbers, using the C :c:type:`Py_complex`
    representation.
 
    If *divisor* is null, this method returns zero and sets
-   :cdata:`errno` to :cdata:`EDOM`.
+   :c:data:`errno` to :c:data:`EDOM`.
 
 
-.. cfunction:: Py_complex _Py_c_pow(Py_complex num, Py_complex exp)
+.. c:function:: Py_complex _Py_c_pow(Py_complex num, Py_complex exp)
 
-   Return the exponentiation of *num* by *exp*, using the C :ctype:`Py_complex`
+   Return the exponentiation of *num* by *exp*, using the C :c:type:`Py_complex`
    representation.
 
    If *num* is null and *exp* is not a positive real number,
-   this method returns zero and sets :cdata:`errno` to :cdata:`EDOM`.
+   this method returns zero and sets :c:data:`errno` to :c:data:`EDOM`.
 
 
 Complex Numbers as Python Objects
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 
-.. ctype:: PyComplexObject
+.. c:type:: PyComplexObject
 
-   This subtype of :ctype:`PyObject` represents a Python complex number object.
+   This subtype of :c:type:`PyObject` represents a Python complex number object.
 
 
-.. cvar:: PyTypeObject PyComplex_Type
+.. c:var:: PyTypeObject PyComplex_Type
 
-   This instance of :ctype:`PyTypeObject` represents the Python complex number
+   This instance of :c:type:`PyTypeObject` represents the Python complex number
    type. It is the same object as ``complex`` and ``types.ComplexType``.
 
 
-.. cfunction:: int PyComplex_Check(PyObject *p)
+.. c:function:: int PyComplex_Check(PyObject *p)
 
-   Return true if its argument is a :ctype:`PyComplexObject` or a subtype of
-   :ctype:`PyComplexObject`.
+   Return true if its argument is a :c:type:`PyComplexObject` or a subtype of
+   :c:type:`PyComplexObject`.
 
    .. versionchanged:: 2.2
       Allowed subtypes to be accepted.
 
 
-.. cfunction:: int PyComplex_CheckExact(PyObject *p)
+.. c:function:: int PyComplex_CheckExact(PyObject *p)
 
-   Return true if its argument is a :ctype:`PyComplexObject`, but not a subtype of
-   :ctype:`PyComplexObject`.
+   Return true if its argument is a :c:type:`PyComplexObject`, but not a subtype of
+   :c:type:`PyComplexObject`.
 
    .. versionadded:: 2.2
 
 
-.. cfunction:: PyObject* PyComplex_FromCComplex(Py_complex v)
+.. c:function:: PyObject* PyComplex_FromCComplex(Py_complex v)
 
-   Create a new Python complex number object from a C :ctype:`Py_complex` value.
+   Create a new Python complex number object from a C :c:type:`Py_complex` value.
 
 
-.. cfunction:: PyObject* PyComplex_FromDoubles(double real, double imag)
+.. c:function:: PyObject* PyComplex_FromDoubles(double real, double imag)
 
-   Return a new :ctype:`PyComplexObject` object from *real* and *imag*.
+   Return a new :c:type:`PyComplexObject` object from *real* and *imag*.
 
 
-.. cfunction:: double PyComplex_RealAsDouble(PyObject *op)
+.. c:function:: double PyComplex_RealAsDouble(PyObject *op)
 
-   Return the real part of *op* as a C :ctype:`double`.
+   Return the real part of *op* as a C :c:type:`double`.
 
 
-.. cfunction:: double PyComplex_ImagAsDouble(PyObject *op)
+.. c:function:: double PyComplex_ImagAsDouble(PyObject *op)
 
-   Return the imaginary part of *op* as a C :ctype:`double`.
+   Return the imaginary part of *op* as a C :c:type:`double`.
 
 
-.. cfunction:: Py_complex PyComplex_AsCComplex(PyObject *op)
+.. c:function:: Py_complex PyComplex_AsCComplex(PyObject *op)
 
-   Return the :ctype:`Py_complex` value of the complex number *op*.
+   Return the :c:type:`Py_complex` value of the complex number *op*.
    Upon failure, this method returns ``-1.0`` as a real value.
 
    .. versionchanged:: 2.6

Doc/c-api/concrete.rst

 Passing them an object of the wrong type is not a good idea; if you receive an
 object from a Python program and you are not sure that it has the right type,
 you must perform a type check first; for example, to check that an object is a
-dictionary, use :cfunc:`PyDict_Check`.  The chapter is structured like the
+dictionary, use :c:func:`PyDict_Check`.  The chapter is structured like the
 "family tree" of Python object types.
 
 .. warning::

Doc/c-api/conversion.rst

 Functions for number conversion and formatted string output.
 
 
-.. cfunction:: int PyOS_snprintf(char *str, size_t size,  const char *format, ...)
+.. c:function:: int PyOS_snprintf(char *str, size_t size,  const char *format, ...)
 
    Output not more than *size* bytes to *str* according to the format string
    *format* and the extra arguments. See the Unix man page :manpage:`snprintf(2)`.
 
 
-.. cfunction:: int PyOS_vsnprintf(char *str, size_t size, const char *format, va_list va)
+.. c:function:: int PyOS_vsnprintf(char *str, size_t size, const char *format, va_list va)
 
    Output not more than *size* bytes to *str* according to the format string
    *format* and the variable argument list *va*. Unix man page
    :manpage:`vsnprintf(2)`.
 
-:cfunc:`PyOS_snprintf` and :cfunc:`PyOS_vsnprintf` wrap the Standard C library
-functions :cfunc:`snprintf` and :cfunc:`vsnprintf`. Their purpose is to
+:c:func:`PyOS_snprintf` and :c:func:`PyOS_vsnprintf` wrap the Standard C library
+functions :c:func:`snprintf` and :c:func:`vsnprintf`. Their purpose is to
 guarantee consistent behavior in corner cases, which the Standard C functions do
 not.
 
 Both functions require that ``str != NULL``, ``size > 0`` and ``format !=
 NULL``.