8000 gh-107298: Fix Sphinx warnings in the C API doc · python/cpython@ce998cf · GitHub
[go: up one dir, main page]

Skip to content

Commit ce998cf

Browse files
committed
gh-107298: Fix Sphinx warnings in the C API doc
1 parent b1de380 commit ce998cf

File tree

12 files changed

+29
-29
lines changed

12 files changed

+29
-29
lines changed

Doc/c-api/apiabiversion.rst

Lines changed: 1 addition & 1 deletion
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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ Simple objects such as :class:`bytes` and :class:`bytearray` expose their
4242
underlying buffer in byte-oriented form. Other forms are possible; for example,
4343
the elements exposed by an :class:`array.array` can be multi-byte values.
4444

45-
An example consumer of the buffer interface is the :meth:`~io.BufferedIOBase.write`
45+
An example consumer of the buffer interface is the :meth:`!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

Lines changed: 12 additions & 12 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 3 additions & 3 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 2 additions & 2 deletions
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/tuple.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ type.
165165
166166
Describes a field of a struct sequence. As a struct sequence is modeled as a
167167
tuple, all fields are typed as :c:expr:`PyObject*`. The index in the
168-
:attr:`fields` array of the :c:type:`PyStructSequence_Desc` determines which
168+
``fields`` array of the :c:type:`PyStructSequence_Desc` determines which
169169
field of the struct sequence is described.
170170
171171
+-----------+------------------+-----------------------------------------+

Doc/c-api/type.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -477,10 +477,10 @@ The following functions and structs are used to create
477477
* :c:member:`~PyTypeObject.tp_vectorcall_offset`
478478
(see :ref:`PyMemberDef <pymemberdef-offsets>`)
479479
480-
Setting :c:data:`Py_tp_bases` or :c:data:`Py_tp_base` may be
480+
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

Lines changed: 1 addition & 1 deletion
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

0 commit comments

Comments
 (0)
0