Skip to content

Commit ef7422a

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

12 files changed

+29
-37
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
@@ -64,39 +64,39 @@ called with a non-bytes parameter.
6464
+-------------------+---------------+--------------------------------+
6565
| Format Characters | Type | Comment |
6666
+===================+===============+================================+
67-
| :attr:`%%` | *n/a* | The literal % character. |
67+
| ``%%`` | *n/a* | The literal % character. |
6868
+-------------------+---------------+--------------------------------+
69-
| :attr:`%c` | int | A single byte, |
69+
| ``%c`` | int | A single byte, |
7070
| | | represented as a C int. |
7171
+-------------------+---------------+--------------------------------+
72-
| :attr:`%d` | int | Equivalent to |
72+
| ``%d`` | int | Equivalent to |
7373
| | | ``printf("%d")``. [1]_ |
7474
+-------------------+---------------+--------------------------------+
75-
| :attr:`%u` | unsigned int | Equivalent to |
75+
| ``%u`` | unsigned int | Equivalent to |
7676
| | | ``printf("%u")``. [1]_ |
7777
+-------------------+---------------+--------------------------------+
78-
| :attr:`%ld` | long | Equivalent to |
78+
| ``%ld`` | long | Equivalent to |
7979
| | | ``printf("%ld")``. [1]_ |
8080
+-------------------+---------------+--------------------------------+
81-
| :attr:`%lu` | unsigned long | Equivalent to |
81+
| ``%lu`` | unsigned long | Equivalent to |
8282
| | | ``printf("%lu")``. [1]_ |
8383
+-------------------+---------------+--------------------------------+
84-
| :attr:`%zd` | :c:type:`\ | Equivalent to |
84+
| ``%zd`` | :c:type:`\ | Equivalent to |
8585
| | Py_ssize_t` | ``printf("%zd")``. [1]_ |
8686
+-------------------+---------------+--------------------------------+
87-
| :attr:`%zu` | size_t | Equivalent to |
87+
| ``%zu`` | size_t | Equivalent to |
8888
| | | ``printf("%zu")``. [1]_ |
8989
+-------------------+---------------+--------------------------------+
90-
| :attr:`%i` | int | Equivalent to |
90+
| ``%i`` | int | Equivalent to |
9191
| | | ``printf("%i")``. [1]_ |
9292
+-------------------+---------------+--------------------------------+
93-
| :attr:`%x` | int | Equivalent to |
93+
| ``%x`` | int | Equivalent to |
9494
| | | ``printf("%x")``. [1]_ |
9595
+-------------------+---------------+--------------------------------+
96-
| :attr:`%s` | const char\* | A null-terminated C character |
96+
| ``%s`` | const char\* | A null-terminated C character |
9797
| | | array. |
9898
+-------------------+---------------+--------------------------------+
99-
| :attr:`%p` | const void\* | The hex representation of a C |
99+
| ``%p`` | const void\* | The hex representation of a C |
100100
| | | pointer. Mostly equivalent to |
101101
| | | ``printf("%p")`` except that |
102102
| | | 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/code.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ bound into a function.
3939
use :c:func:`PyCode_NewEmpty` instead.
4040
4141
Since the definition of the bytecode changes often, calling
42-
:c:func:`PyCode_New` directly can bind you to a precise Python version.
42+
:c:func:`PyUnstable_Code_New` directly can bind you to a precise Python version.
4343
4444
The many arguments of this function are inter-dependent in complex
4545
ways, meaning that subtle changes to values are likely to result in incorrect
@@ -58,8 +58,8 @@ bound into a function.
5858
5959
.. c:function:: PyCodeObject* PyUnstable_Code_NewWithPosOnlyArgs(int argcount, int posonlyargcount, int kwonlyargcount, 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 *linetable, PyObject *exceptiontable)
6060
61-
Similar to :c:func:`PyCode_New`, but with an extra "posonlyargcount" for positional-only arguments.
62-
The same caveats that apply to ``PyCode_New`` also apply to this function.
61+
Similar to :c:func:`PyUnstable_Code_New`, but with an extra "posonlyargcount" for positional-only arguments.
62+
The same caveats that apply to ``PyUnstable_Code_New`` also apply to this function.
6363
6464
.. index:: single: PyCode_NewWithPosOnlyArgs
6565

Doc/c-api/gcsupport.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ rules:
143143
144144
.. versionchanged:: 3.8
145145
146-
The :c:func:`_PyObject_GC_TRACK` and :c:func:`_PyObject_GC_UNTRACK` macros
146+
The :c:func:`!_PyObject_GC_TRACK` and :c:func:`!_PyObject_GC_UNTRACK` macros
147147
have been removed from the public C API.
148148
149149
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
@@ -480,7 +480,7 @@ The following functions and structs are used to create
480480
Setting :c:data:`Py_tp_bases` or :c:data:`Py_tp_base` may be
481481
problematic on some platforms.
482482
To avoid issues, use the *bases* argument of
483-
:py:func:`PyType_FromSpecWithBases` instead.
483+
:c:func:`PyType_FromSpecWithBases` instead.
484484
485485
.. versionchanged:: 3.9
486486

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
@@ -1214,7 +1214,7 @@ This codec is special in that it can be used to implement many different codecs
12141214
(and this is in fact what was done to obtain most of the standard codecs
12151215
included in the :mod:`!encodings` package). The codec uses mappings to encode and
12161216
decode characters. The mapping objects provided must support the
1217-
:meth:`__getitem__` mapping interface; dictionaries and sequences work well.
1217+
:meth:`~object.__getitem__` mapping interface; dictionaries and sequences work well.
12181218
12191219
These are the mapping codec APIs:
12201220
@@ -1257,7 +1257,7 @@ The following codec API is special in that maps Unicode to Unicode.
12571257
The mapping table must map Unicode ordinal integers to Unicode ordinal integers
12581258
or ``None`` (causing deletion of the character).
12591259
1260-
Mapping tables need only provide the :meth:`__getitem__` interface; dictionaries
1260+
Mapping tables need only provide the :meth:`~object.__getitem__` interface; dictionaries
12611261
and sequences work well. Unmapped character ordinals (ones which cause a
12621262
:exc:`LookupError`) are left untouched and are copied as-is.
12631263

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

Doc/tools/.nitignore

-8
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,10 @@
44
# to help avoid merge conflicts.
55

66
Doc/c-api/allocation.rst
7-
Doc/c-api/apiabiversion.rst
87
Doc/c-api/arg.rst
98
Doc/c-api/bool.rst
109
Doc/c-api/buffer.rst
11-
Doc/c-api/bytes.rst
1210
Doc/c-api/capsule.rst
13-
Doc/c-api/cell.rst
14-
Doc/c-api/code.rst
1511
Doc/c-api/complex.rst
1612
Doc/c-api/conversion.rst
1713
Doc/c-api/datetime.rst
@@ -25,7 +21,6 @@ Doc/c-api/import.rst
2521
Doc/c-api/init.rst
2622
Doc/c-api/init_config.rst
2723
Doc/c-api/intro.rst
28-
Doc/c-api/iterator.rst
2924
Doc/c-api/memory.rst
3025
Doc/c-api/memoryview.rst
3126
Doc/c-api/module.rst
@@ -36,11 +31,8 @@ Doc/c-api/stable.rst
3631
Doc/c-api/structures.rst
3732
Doc/c-api/sys.rst
3833
Doc/c-api/type.rst
39-
Doc/c-api/typehints.rst
4034
Doc/c-api/typeobj.rst
4135
Doc/c-api/unicode.rst
42-
Doc/c-api/veryhigh.rst
43-
Doc/c-api/weakref.rst
4436
Doc/extending/embedding.rst
4537
Doc/extending/extending.rst
4638
Doc/extending/newtypes.rst

0 commit comments

Comments
 (0)