Skip to content

Commit 5b0984e

Browse files
committed
gh-107298: Fix Sphinx warnings in the C API doc
* Update Doc/tools/.nitignore * Fix BufferedIOBase.write() link in buffer.rst
1 parent 507d8bc commit 5b0984e

12 files changed

+26
-33
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
@@ -1207,7 +1207,7 @@ This codec is special in that it can be used to implement many different codecs
12071207
(and this is in fact what was done to obtain most of the standard codecs
12081208
included in the :mod:`!encodings` package). The codec uses mappings to encode and
12091209
decode characters. The mapping objects provided must support the
1210-
:meth:`__getitem__` mapping interface; dictionaries and sequences work well.
1210+
:meth:`~object.__getitem__` mapping interface; dictionaries and sequences work well.
12111211
12121212
These are the mapping codec APIs:
12131213
@@ -1250,7 +1250,7 @@ The following codec API is special in that maps Unicode to Unicode.
12501250
The mapping table must map Unicode ordinal integers to Unicode ordinal integers
12511251
or ``None`` (causing deletion of the character).
12521252
1253-
Mapping tables need only provide the :meth:`__getitem__` interface; dictionaries
1253+
Mapping tables need only provide the :meth:`~object.__getitem__` interface; dictionaries
12541254
and sequences work well. Unmapped character ordinals (ones which cause a
12551255
:exc:`LookupError`) are left untouched and are copied as-is.
12561256

Doc/c-api/veryhigh.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ the same library that the Python runtime is using.
353353
executed, it is passed as ``PyCompilerFlags *flags``. In this case, ``from
354354
__future__ import`` can modify *flags*.
355355
356-
Whenever ``PyCompilerFlags *flags`` is ``NULL``, :attr:`cf_flags` is treated as
356+
Whenever ``PyCompilerFlags *flags`` is ``NULL``, :c:member:`cf_flags` is treated as
357357
equal to ``0``, and any modification due to ``from __future__ import`` is
358358
discarded.
359359

Doc/tools/.nitignore

-7
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,9 @@
33
# Keep lines sorted lexicographically to help avoid merge conflicts.
44

55
Doc/c-api/allocation.rst
6-
Doc/c-api/apiabiversion.rst
76
Doc/c-api/bool.rst
87
Doc/c-api/buffer.rst
9-
Doc/c-api/bytes.rst
108
Doc/c-api/capsule.rst
11-
Doc/c-api/cell.rst
12-
Doc/c-api/code.rst
139
Doc/c-api/complex.rst
1410
Doc/c-api/conversion.rst
1511
Doc/c-api/datetime.rst
@@ -22,7 +18,6 @@ Doc/c-api/import.rst
2218
Doc/c-api/init.rst
2319
Doc/c-api/init_config.rst
2420
Doc/c-api/intro.rst
25-
Doc/c-api/iterator.rst
2621
Doc/c-api/memory.rst
2722
Doc/c-api/memoryview.rst
2823
Doc/c-api/module.rst
@@ -34,10 +29,8 @@ Doc/c-api/structures.rst
3429
Doc/c-api/sys.rst
3530
Doc/c-api/tuple.rst
3631
Doc/c-api/type.rst
37-
Doc/c-api/typehints.rst
3832
Doc/c-api/typeobj.rst
3933
Doc/c-api/unicode.rst
40-
Doc/c-api/veryhigh.rst
4134
Doc/extending/embedding.rst
4235
Doc/extending/extending.rst
4336
Doc/extending/newtypes.rst

0 commit comments

Comments
 (0)