Skip to content

Commit 9833052

Browse files
gh-107298: Fix yet more Sphinx warnings in the C API doc (GH-107345)
1 parent ac7a0f8 commit 9833052

19 files changed

+88
-79
lines changed

Doc/c-api/capsule.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ Refer to :ref:`using-capsules` for more information on using these objects.
121121
compared.)
122122
123123
In other words, if :c:func:`PyCapsule_IsValid` returns a true value, calls to
124-
any of the accessors (any function starting with :c:func:`PyCapsule_Get`) are
124+
any of the accessors (any function starting with ``PyCapsule_Get``) are
125125
guaranteed to succeed.
126126
127127
Return a nonzero value if the object is valid and matches the name passed in.

Doc/c-api/init_config.rst

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,8 @@ PyStatus
135135
136136
Name of the function which created an error, can be ``NULL``.
137137
138+
.. c:namespace:: NULL
139+
138140
Functions to create a status:
139141
140142
.. c:function:: PyStatus PyStatus_Ok(void)
@@ -210,6 +212,8 @@ PyPreConfig
210212
211213
Structure used to preinitialize Python.
212214
215+
.. c:namespace:: NULL
216+
213217
Function to initialize a preconfiguration:
214218
215219
.. c:function:: void PyPreConfig_InitPythonConfig(PyPreConfig *preconfig)
@@ -222,6 +226,8 @@ PyPreConfig
222226
Initialize the preconfiguration with :ref:`Isolated Configuration
223227
<init-isolated-conf>`.
224228
229+
.. c:namespace:: PyPreConfig
230+
225231
Structure fields:
226232
227233
.. c:member:: int allocator
@@ -429,6 +435,8 @@ PyConfig
429435
When done, the :c:func:`PyConfig_Clear` function must be used to release the
430436
configuration memory.
431437
438+
.. c:namespace:: NULL
439+
432440
Structure methods:
433441
434442
.. c:function:: void PyConfig_InitPythonConfig(PyConfig *config)
@@ -527,6 +535,8 @@ PyConfig
527535
The caller of these methods is responsible to handle exceptions (error or
528536
exit) using ``PyStatus_Exception()`` and ``Py_ExitStatusException()``.
529537
538+
.. c:namespace:: PyConfig
539+
530540
Structure fields:
531541
532542
.. c:member:: PyWideStringList argv
@@ -938,7 +948,7 @@ PyConfig
938948
.. c:member:: wchar_t* pythonpath_env
939949
940950
Module search paths (:data:`sys.path`) as a string separated by ``DELIM``
941-
(:data:`os.path.pathsep`).
951+
(:data:`os.pathsep`).
942952
943953
Set by the :envvar:`PYTHONPATH` environment variable.
944954

Doc/c-api/intro.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -616,7 +616,7 @@ and lose important information about the exact cause of the error.
616616
.. index:: single: sum_sequence()
617617

618618
A simple example of detecting exceptions and passing them on is shown in the
619-
:c:func:`sum_sequence` example above. It so happens that this example doesn't
619+
:c:func:`!sum_sequence` example above. It so happens that this example doesn't
620620
need to clean up any owned references when it detects an error. The following
621621
example function shows some error cleanup. First, to remind you why you like
622622
Python, we show the equivalent Python code::

Doc/c-api/memory.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,8 @@ Customize Memory Allocators
431431
432432
Enum used to identify an allocator domain. Domains:
433433
434+
.. c:namespace:: NULL
435+
434436
.. c:macro:: PYMEM_DOMAIN_RAW
435437
436438
Functions:

Doc/c-api/module.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ Module Objects
119119
encoded to 'utf-8'.
120120
121121
.. deprecated:: 3.2
122-
:c:func:`PyModule_GetFilename` raises :c:type:`UnicodeEncodeError` on
122+
:c:func:`PyModule_GetFilename` raises :exc:`UnicodeEncodeError` on
123123
unencodable filenames, use :c:func:`PyModule_GetFilenameObject` instead.
124124
125125

Doc/c-api/none.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ The ``None`` Object
99

1010
Note that the :c:type:`PyTypeObject` for ``None`` is not directly exposed in the
1111
Python/C API. Since ``None`` is a singleton, testing for object identity (using
12-
``==`` in C) is sufficient. There is no :c:func:`PyNone_Check` function for the
12+
``==`` in C) is sufficient. There is no :c:func:`!PyNone_Check` function for the
1313
same reason.
1414

1515

Doc/c-api/object.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ Object Protocol
293293
294294
Normally only class objects, i.e. instances of :class:`type` or a derived
295295
class, are considered classes. However, objects can override this by having
296-
a :attr:`__bases__` attribute (which must be a tuple of base classes).
296+
a :attr:`~class.__bases__` attribute (which must be a tuple of base classes).
297297
298298
299299
.. c:function:: int PyObject_IsInstance(PyObject *inst, PyObject *cls)
@@ -310,10 +310,10 @@ Object Protocol
310310
is an instance of *cls* if its class is a subclass of *cls*.
311311
312312
An instance *inst* can override what is considered its class by having a
313-
:attr:`__class__` attribute.
313+
:attr:`~instance.__class__` attribute.
314314
315315
An object *cls* can override if it is considered a class, and what its base
316-
classes are, by having a :attr:`__bases__` attribute (which must be a tuple
316+
classes are, by having a :attr:`~class.__bases__` attribute (which must be a tuple
317317
of base classes).
318318
319319

Doc/c-api/set.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ or :class:`frozenset` or instances of their subtypes.
110110
.. index:: pair: built-in function; len
111111
112112
Return the length of a :class:`set` or :class:`frozenset` object. Equivalent to
113-
``len(anyset)``. Raises a :exc:`PyExc_SystemError` if *anyset* is not a
113+
``len(anyset)``. Raises a :exc:`SystemError` if *anyset* is not a
114114
:class:`set`, :class:`frozenset`, or an instance of a subtype.
115115
116116
@@ -124,7 +124,7 @@ or :class:`frozenset` or instances of their subtypes.
124124
Return ``1`` if found, ``0`` if not found, and ``-1`` if an error is encountered. Unlike
125125
the Python :meth:`~object.__contains__` method, this function does not automatically
126126
convert unhashable sets into temporary frozensets. Raise a :exc:`TypeError` if
127-
the *key* is unhashable. Raise :exc:`PyExc_SystemError` if *anyset* is not a
127+
the *key* is unhashable. Raise :exc:`SystemError` if *anyset* is not a
128128
:class:`set`, :class:`frozenset`, or an instance of a subtype.
129129
130130
@@ -149,7 +149,7 @@ subtypes but not for instances of :class:`frozenset` or its subtypes.
149149
error is encountered. Does not raise :exc:`KeyError` for missing keys. Raise a
150150
:exc:`TypeError` if the *key* is unhashable. Unlike the Python :meth:`~set.discard`
151151
method, this function does not automatically convert unhashable sets into
152-
temporary frozensets. Raise :exc:`PyExc_SystemError` if *set* is not an
152+
temporary frozensets. Raise :exc:`SystemError` if *set* is not an
153153
instance of :class:`set` or its subtype.
154154
155155

Doc/c-api/sys.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ Operating System Utilities
167167
168168
.. versionchanged:: 3.8
169169
The function now uses the UTF-8 encoding on Windows if
170-
:c:member:`PyConfig.legacy_windows_fs_encoding` is zero;
170+
:c:member:`PyPreConfig.legacy_windows_fs_encoding` is zero;
171171
172172
173173
.. c:function:: char* Py_EncodeLocale(const wchar_t *text, size_t *error_pos)
@@ -209,7 +209,7 @@ Operating System Utilities
209209
210210
.. versionchanged:: 3.8
211211
The function now uses the UTF-8 encoding on Windows if
212-
:c:member:`PyConfig.legacy_windows_fs_encoding` is zero.
212+
:c:member:`PyPreConfig.legacy_windows_fs_encoding` is zero.
213213
214214
215215
.. _systemfunctions:

Doc/c-api/type.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ Type Objects
103103
:c:func:`PyType_AddWatcher` will be called whenever
104104
:c:func:`PyType_Modified` reports a change to *type*. (The callback may be
105105
called only once for a series of consecutive modifications to *type*, if
106-
:c:func:`PyType_Lookup` is not called on *type* between the modifications;
106+
:c:func:`!_PyType_Lookup` is not called on *type* between the modifications;
107107
this is an implementation detail and subject to change.)
108108
109109
An extension should never call ``PyType_Watch`` with a *watcher_id* that was

0 commit comments

Comments
 (0)