Skip to content

Commit dcfdfa5

Browse files
[3.11] gh-107298: Fix Sphinx warnings in the C API doc (GH-107302) (GH-107373)
(cherry picked from commit 391e03f) Co-authored-by: Victor Stinner <[email protected]>
1 parent c7d9976 commit dcfdfa5

10 files changed

+26
-26
lines changed

Doc/c-api/apiabiversion.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ See :ref:`stable` for a discussion of API and ABI stability across versions.
6060

6161
Use this for numeric comparisons, e.g. ``#if PY_VERSION_HEX >= ...``.
6262

63-
This version is also available via the symbol :data:`Py_Version`.
63+
This version is also available via the symbol :c:var:`Py_Version`.
6464

6565
.. c:var:: const unsigned long Py_Version
6666

Doc/c-api/buffer.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ the elements exposed by an :class:`array.array` can be multi-byte values.
4444

4545
An example consumer of the buffer interface is the :meth:`~io.BufferedIOBase.write`
4646
method of file objects: any object that can export a series of bytes through
47-
the buffer interface can be written to a file. While :meth:`write` only
47+
the buffer interface can be written to a file. While :meth:`!write` only
4848
needs read-only access to the internal contents of the object passed to it,
4949
other methods such as :meth:`~io.BufferedIOBase.readinto` need write access
5050
to the contents of their argument. The buffer interface allows objects to

Doc/c-api/bytes.rst

+12-12
Original file line numberDiff line numberDiff line change
@@ -67,39 +67,39 @@ called with a non-bytes parameter.
6767
+-------------------+---------------+--------------------------------+
6868
| Format Characters | Type | Comment |
6969
+===================+===============+================================+
70-
| :attr:`%%` | *n/a* | The literal % character. |
70+
| ``%%`` | *n/a* | The literal % character. |
7171
+-------------------+---------------+--------------------------------+
72-
| :attr:`%c` | int | A single byte, |
72+
| ``%c`` | int | A single byte, |
7373
| | | represented as a C int. |
7474
+-------------------+---------------+--------------------------------+
75-
| :attr:`%d` | int | Equivalent to |
75+
| ``%d`` | int | Equivalent to |
7676
| | | ``printf("%d")``. [1]_ |
7777
+-------------------+---------------+--------------------------------+
78-
| :attr:`%u` | unsigned int | Equivalent to |
78+
| ``%u`` | unsigned int | Equivalent to |
7979
| | | ``printf("%u")``. [1]_ |
8080
+-------------------+---------------+--------------------------------+
81-
| :attr:`%ld` | long | Equivalent to |
81+
| ``%ld`` | long | Equivalent to |
8282
| | | ``printf("%ld")``. [1]_ |
8383
+-------------------+---------------+--------------------------------+
84-
| :attr:`%lu` | unsigned long | Equivalent to |
84+
| ``%lu`` | unsigned long | Equivalent to |
8585
| | | ``printf("%lu")``. [1]_ |
8686
+-------------------+---------------+--------------------------------+
87-
| :attr:`%zd` | :c:type:`\ | Equivalent to |
87+
| ``%zd`` | :c:type:`\ | Equivalent to |
8888
| | Py_ssize_t` | ``printf("%zd")``. [1]_ |
8989
+-------------------+---------------+--------------------------------+
90-
| :attr:`%zu` | size_t | Equivalent to |
90+
| ``%zu`` | size_t | Equivalent to |
9191
| | | ``printf("%zu")``. [1]_ |
9292
+-------------------+---------------+--------------------------------+
93-
| :attr:`%i` | int | Equivalent to |
93+
| ``%i`` | int | Equivalent to |
9494
| | | ``printf("%i")``. [1]_ |
9595
+-------------------+---------------+--------------------------------+
96-
| :attr:`%x` | int | Equivalent to |
96+
| ``%x`` | int | Equivalent to |
9797
| | | ``printf("%x")``. [1]_ |
9898
+-------------------+---------------+--------------------------------+
99-
| :attr:`%s` | const char\* | A null-terminated C character |
99+
| ``%s`` | const char\* | A null-terminated C character |
100100
| | | array. |
101101
+-------------------+---------------+--------------------------------+
102-
| :attr:`%p` | const void\* | The hex representation of a C |
102+
| ``%p`` | const void\* | The hex representation of a C |
103103
| | | pointer. Mostly equivalent to |
104104
| | | ``printf("%p")`` except that |
105105
| | | it is guaranteed to start with |

Doc/c-api/cell.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Cell objects are not likely to be useful elsewhere.
2525
The type object corresponding to cell objects.
2626

2727

28-
.. c:function:: int PyCell_Check(ob)
28+
.. c:function:: int PyCell_Check(PyObject *ob)
2929
3030
Return true if *ob* is a cell object; *ob* must not be ``NULL``. This
3131
function always succeeds.

Doc/c-api/gcsupport.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ rules:
124124
125125
.. versionchanged:: 3.8
126126
127-
The :c:func:`_PyObject_GC_TRACK` and :c:func:`_PyObject_GC_UNTRACK` macros
127+
The :c:func:`!_PyObject_GC_TRACK` and :c:func:`!_PyObject_GC_UNTRACK` macros
128128
have been removed from the public C API.
129129
130130
The :c:member:`~PyTypeObject.tp_traverse` handler accepts a function parameter of this type:

Doc/c-api/iterator.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ sentinel value is returned.
1919
types.
2020

2121

22-
.. c:function:: int PySeqIter_Check(op)
22+
.. c:function:: int PySeqIter_Check(PyObject *op)
2323
2424
Return true if the type of *op* is :c:data:`PySeqIter_Type`. This function
2525
always succeeds.
@@ -38,7 +38,7 @@ sentinel value is returned.
3838
two-argument form of the :func:`iter` built-in function.
3939
4040
41-
.. c:function:: int PyCallIter_Check(op)
41+
.. c:function:: int PyCallIter_Check(PyObject *op)
4242
4343
Return true if the type of *op* is :c:data:`PyCallIter_Type`. This
4444
function always succeeds.

Doc/c-api/type.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ The following functions and structs are used to create
292292
Setting :c:data:`Py_tp_bases` or :c:data:`Py_tp_base` may be
293293
problematic on some platforms.
294294
To avoid issues, use the *bases* argument of
295-
:py:func:`PyType_FromSpecWithBases` instead.
295+
:c:func:`PyType_FromSpecWithBases` instead.
296296
297297
.. versionchanged:: 3.9
298298

Doc/c-api/typehints.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ two types exist -- :ref:`GenericAlias <types-genericalias>` and
3535
...
3636
}
3737
38-
.. seealso:: The data model method :meth:`__class_getitem__`.
38+
.. seealso:: The data model method :meth:`~object.__class_getitem__`.
3939
4040
.. versionadded:: 3.9
4141

Doc/c-api/unicode.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -1306,7 +1306,7 @@ This codec is special in that it can be used to implement many different codecs
13061306
(and this is in fact what was done to obtain most of the standard codecs
13071307
included in the :mod:`!encodings` package). The codec uses mappings to encode and
13081308
decode characters. The mapping objects provided must support the
1309-
:meth:`__getitem__` mapping interface; dictionaries and sequences work well.
1309+
:meth:`~object.__getitem__` mapping interface; dictionaries and sequences work well.
13101310
13111311
These are the mapping codec APIs:
13121312
@@ -1349,7 +1349,7 @@ The following codec API is special in that maps Unicode to Unicode.
13491349
The mapping table must map Unicode ordinal integers to Unicode ordinal integers
13501350
or ``None`` (causing deletion of the character).
13511351
1352-
Mapping tables need only provide the :meth:`__getitem__` interface; dictionaries
1352+
Mapping tables need only provide the :meth:`~object.__getitem__` interface; dictionaries
13531353
and sequences work well. Unmapped character ordinals (ones which cause a
13541354
:exc:`LookupError`) are left untouched and are copied as-is.
13551355

Doc/c-api/weakref.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,18 @@ simple reference object, and the second acts as a proxy for the original object
1111
as much as it can.
1212

1313

14-
.. c:function:: int PyWeakref_Check(ob)
14+
.. c:function:: int PyWeakref_Check(PyObject *ob)
1515
1616
Return true if *ob* is either a reference or proxy object. This function
1717
always succeeds.
1818
1919
20-
.. c:function:: int PyWeakref_CheckRef(ob)
20+
.. c:function:: int PyWeakref_CheckRef(PyObject *ob)
2121
2222
Return true if *ob* is a reference object. This function always succeeds.
2323
2424
25-
.. c:function:: int PyWeakref_CheckProxy(ob)
25+
.. c:function:: int PyWeakref_CheckProxy(PyObject *ob)
2626
2727
Return true if *ob* is a proxy object. This function always succeeds.
2828
@@ -54,7 +54,7 @@ as much as it can.
5454
.. c:function:: PyObject* PyWeakref_GetObject(PyObject *ref)
5555
5656
Return the referenced object from a weak reference, *ref*. If the referent is
57-
no longer live, returns :const:`Py_None`.
57+
no longer live, returns ``Py_None``.
5858
5959
.. note::
6060

0 commit comments

Comments
 (0)