]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.11] gh-107298: Fix Sphinx warnings in the C API doc (GH-107302) (GH-107373)
authorSerhiy Storchaka <storchaka@gmail.com>
Fri, 28 Jul 2023 06:44:54 +0000 (09:44 +0300)
committerGitHub <noreply@github.com>
Fri, 28 Jul 2023 06:44:54 +0000 (06:44 +0000)
(cherry picked from commit 391e03fa05b80d17a14ac88d30c974fa2fa00adb)

Co-authored-by: Victor Stinner <vstinner@python.org>
Doc/c-api/apiabiversion.rst
Doc/c-api/buffer.rst
Doc/c-api/bytes.rst
Doc/c-api/cell.rst
Doc/c-api/gcsupport.rst
Doc/c-api/iterator.rst
Doc/c-api/type.rst
Doc/c-api/typehints.rst
Doc/c-api/unicode.rst
Doc/c-api/weakref.rst

index 62d542966622cedc87fbfdd6187c2416d072977b..f6c8284daeacb0a28a2f0a4f5b87c527addc2b2a 100644 (file)
@@ -60,7 +60,7 @@ See :ref:`stable` for a discussion of API and ABI stability across versions.
 
    Use this for numeric comparisons, e.g. ``#if PY_VERSION_HEX >= ...``.
 
-   This version is also available via the symbol :data:`Py_Version`.
+   This version is also available via the symbol :c:var:`Py_Version`.
 
 .. c:var:: const unsigned long Py_Version
 
index 6e5443f0d6cdc5ab5f0ec0552f82dbdc3cd1d511..02b53ec149c733e4aa345ebf38260d65924269cf 100644 (file)
@@ -44,7 +44,7 @@ the elements exposed by an :class:`array.array` can be multi-byte values.
 
 An example consumer of the buffer interface is the :meth:`~io.BufferedIOBase.write`
 method of file objects: any object that can export a series of bytes through
-the buffer interface can be written to a file.  While :meth:`write` only
+the buffer interface can be written to a file.  While :meth:`!write` only
 needs read-only access to the internal contents of the object passed to it,
 other methods such as :meth:`~io.BufferedIOBase.readinto` need write access
 to the contents of their argument.  The buffer interface allows objects to
index 21a5ab931c8bfbd191c6398a9eececcd9136dec9..110a98e19d8237927d338446a0a3e3776daf34b3 100644 (file)
@@ -67,39 +67,39 @@ called with a non-bytes parameter.
    +-------------------+---------------+--------------------------------+
    | Format Characters | Type          | Comment                        |
    +===================+===============+================================+
-   | :attr:`%%`        | *n/a*         | The literal % character.       |
+   | ``%%``            | *n/a*         | The literal % character.       |
    +-------------------+---------------+--------------------------------+
-   | :attr:`%c`        | int           | A single byte,                 |
+   | ``%c``            | int           | A single byte,                 |
    |                   |               | represented as a C int.        |
    +-------------------+---------------+--------------------------------+
-   | :attr:`%d`        | int           | Equivalent to                  |
+   | ``%d``            | int           | Equivalent to                  |
    |                   |               | ``printf("%d")``. [1]_         |
    +-------------------+---------------+--------------------------------+
-   | :attr:`%u`        | unsigned int  | Equivalent to                  |
+   | ``%u``            | unsigned int  | Equivalent to                  |
    |                   |               | ``printf("%u")``. [1]_         |
    +-------------------+---------------+--------------------------------+
-   | :attr:`%ld`       | long          | Equivalent to                  |
+   | ``%ld``           | long          | Equivalent to                  |
    |                   |               | ``printf("%ld")``. [1]_        |
    +-------------------+---------------+--------------------------------+
-   | :attr:`%lu`       | unsigned long | Equivalent to                  |
+   | ``%lu``           | unsigned long | Equivalent to                  |
    |                   |               | ``printf("%lu")``. [1]_        |
    +-------------------+---------------+--------------------------------+
-   | :attr:`%zd`       | :c:type:`\    | Equivalent to                  |
+   | ``%zd``           | :c:type:`\    | Equivalent to                  |
    |                   | Py_ssize_t`   | ``printf("%zd")``. [1]_        |
    +-------------------+---------------+--------------------------------+
-   | :attr:`%zu`       | size_t        | Equivalent to                  |
+   | ``%zu``           | size_t        | Equivalent to                  |
    |                   |               | ``printf("%zu")``. [1]_        |
    +-------------------+---------------+--------------------------------+
-   | :attr:`%i`        | int           | Equivalent to                  |
+   | ``%i``            | int           | Equivalent to                  |
    |                   |               | ``printf("%i")``. [1]_         |
    +-------------------+---------------+--------------------------------+
-   | :attr:`%x`        | int           | Equivalent to                  |
+   | ``%x``            | int           | Equivalent to                  |
    |                   |               | ``printf("%x")``. [1]_         |
    +-------------------+---------------+--------------------------------+
-   | :attr:`%s`        | const char\*  | A null-terminated C character  |
+   | ``%s``            | const char\*  | A null-terminated C character  |
    |                   |               | array.                         |
    +-------------------+---------------+--------------------------------+
-   | :attr:`%p`        | const void\*  | The hex representation of a C  |
+   | ``%p``            | const void\*  | The hex representation of a C  |
    |                   |               | pointer. Mostly equivalent to  |
    |                   |               | ``printf("%p")`` except that   |
    |                   |               | it is guaranteed to start with |
index ac4ef5adc5cc20f8b95d3a892a43080a08e5f719..f8cd0344fdd1c0c93eb00b40120e67d61a753169 100644 (file)
@@ -25,7 +25,7 @@ Cell objects are not likely to be useful elsewhere.
    The type object corresponding to cell objects.
 
 
-.. c:function:: int PyCell_Check(ob)
+.. c:function:: int PyCell_Check(PyObject *ob)
 
    Return true if *ob* is a cell object; *ob* must not be ``NULL``.  This
    function always succeeds.
index fc690fd85c9f747ab70b8cdc52e7dd7ae496a162..ac938735a67ddeb6b85a61b9eda27b37f5a5430c 100644 (file)
@@ -124,7 +124,7 @@ rules:
 
 .. versionchanged:: 3.8
 
-   The :c:func:`_PyObject_GC_TRACK` and :c:func:`_PyObject_GC_UNTRACK` macros
+   The :c:func:`!_PyObject_GC_TRACK` and :c:func:`!_PyObject_GC_UNTRACK` macros
    have been removed from the public C API.
 
 The :c:member:`~PyTypeObject.tp_traverse` handler accepts a function parameter of this type:
index 95952237ca746fd475936f0d5d30dd0f7b659e4f..6b7ba8c997916347cea542d58764811bc5610cf3 100644 (file)
@@ -19,7 +19,7 @@ sentinel value is returned.
    types.
 
 
-.. c:function:: int PySeqIter_Check(op)
+.. c:function:: int PySeqIter_Check(PyObject *op)
 
    Return true if the type of *op* is :c:data:`PySeqIter_Type`.  This function
    always succeeds.
@@ -38,7 +38,7 @@ sentinel value is returned.
    two-argument form of the :func:`iter` built-in function.
 
 
-.. c:function:: int PyCallIter_Check(op)
+.. c:function:: int PyCallIter_Check(PyObject *op)
 
    Return true if the type of *op* is :c:data:`PyCallIter_Type`.  This
    function always succeeds.
index d6f32ed88b673b8064c44b20dd8aa6f7fed6bfe9..01d7fc4dc1ecf1860cc07ab4ecbec51d3fe6b2da 100644 (file)
@@ -292,7 +292,7 @@ The following functions and structs are used to create
       Setting :c:data:`Py_tp_bases` or :c:data:`Py_tp_base` may be
       problematic on some platforms.
       To avoid issues, use the *bases* argument of
-      :py:func:`PyType_FromSpecWithBases` instead.
+      :c:func:`PyType_FromSpecWithBases` instead.
 
      .. versionchanged:: 3.9
 
index 4c1957a2a1dbca0dfd5c5aed255af3286dd46b5b..98fe68737deb81c31720551c48537c080e058e5a 100644 (file)
@@ -35,7 +35,7 @@ two types exist -- :ref:`GenericAlias <types-genericalias>` and
           ...
       }
 
-   .. seealso:: The data model method :meth:`__class_getitem__`.
+   .. seealso:: The data model method :meth:`~object.__class_getitem__`.
 
    .. versionadded:: 3.9
 
index 62628c33a2bbdf82365b4e552f1e617c028dabd7..1ed1f06f4595d82709f6c1dc81604c47c6a30048 100644 (file)
@@ -1306,7 +1306,7 @@ This codec is special in that it can be used to implement many different codecs
 (and this is in fact what was done to obtain most of the standard codecs
 included in the :mod:`!encodings` package). The codec uses mappings to encode and
 decode characters.  The mapping objects provided must support the
-:meth:`__getitem__` mapping interface; dictionaries and sequences work well.
+:meth:`~object.__getitem__` mapping interface; dictionaries and sequences work well.
 
 These are the mapping codec APIs:
 
@@ -1349,7 +1349,7 @@ The following codec API is special in that maps Unicode to Unicode.
    The mapping table must map Unicode ordinal integers to Unicode ordinal integers
    or ``None`` (causing deletion of the character).
 
-   Mapping tables need only provide the :meth:`__getitem__` interface; dictionaries
+   Mapping tables need only provide the :meth:`~object.__getitem__` interface; dictionaries
    and sequences work well.  Unmapped character ordinals (ones which cause a
    :exc:`LookupError`) are left untouched and are copied as-is.
 
index f27ec4411b4a2610299dcf84e554d54f14a294ff..f46507608606b9d209a4b7175a36e97b4e744dd8 100644 (file)
@@ -11,18 +11,18 @@ simple reference object, and the second acts as a proxy for the original object
 as much as it can.
 
 
-.. c:function:: int PyWeakref_Check(ob)
+.. c:function:: int PyWeakref_Check(PyObject *ob)
 
    Return true if *ob* is either a reference or proxy object.  This function
    always succeeds.
 
 
-.. c:function:: int PyWeakref_CheckRef(ob)
+.. c:function:: int PyWeakref_CheckRef(PyObject *ob)
 
    Return true if *ob* is a reference object.  This function always succeeds.
 
 
-.. c:function:: int PyWeakref_CheckProxy(ob)
+.. c:function:: int PyWeakref_CheckProxy(PyObject *ob)
 
    Return true if *ob* is a proxy object.  This function always succeeds.
 
@@ -54,7 +54,7 @@ as much as it can.
 .. c:function:: PyObject* PyWeakref_GetObject(PyObject *ref)
 
    Return the referenced object from a weak reference, *ref*.  If the referent is
-   no longer live, returns :const:`Py_None`.
+   no longer live, returns ``Py_None``.
 
    .. note::