8000 gh-115172: Fix explicit index extries for the C API (GH-115173) · python/cpython@573acb3 · GitHub
[go: up one dir, main page]

Skip to content

Commit 573acb3

Browse files
gh-115172: Fix explicit index extries for the C API (GH-115173)
1 parent 4a08e7b commit 573acb3

File tree

14 files changed

+150
-153
lines changed

14 files changed

+150
-153
lines changed

Doc/c-api/buffer.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ without intermediate copying.
2929
Python provides such a facility at the C level in the form of the :ref:`buffer
3030
protocol <bufferobjects>`. This protocol has two sides:
3131

32-
.. index:: single: PyBufferProcs
32+
.. index:: single: PyBufferProcs (C type)
3333

3434
- on the producer side, a type can export a "buffer interface" which allows
3535
objects of that type to expose information about their underlying buffer.

Doc/c-api/code.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ bound into a function.
4949
.. versionchanged:: 3.11
5050
Added ``qualname`` and ``exceptiontable`` parameters.
5151
52-
.. index:: single: PyCode_New
52+
.. index:: single: PyCode_New (C function)
5353
5454
.. versionchanged:: 3.12
5555
@@ -62,7 +62,7 @@ bound into a function.
6262
Similar to :c:func:`PyUnstable_Code_New`, but with an extra "posonlyargcount" for positional-only arguments.
6363
The same caveats that apply to ``PyUnstable_Code_New`` also apply to this function.
6464
65-
.. index:: single: PyCode_NewWithPosOnlyArgs
65+
.. index:: single: PyCode_NewWithPosOnlyArgs (C function)
6666
6767
.. versionadded:: 3.8 as ``PyCode_NewWithPosOnlyArgs``
6868
@@ -221,7 +221,7 @@ may change without deprecation warnings.
221221
*free* will be called on non-``NULL`` data stored under the new index.
222222
Use :c:func:`Py_DecRef` when storing :c:type:`PyObject`.
223223
224-
.. index:: single: _PyEval_RequestCodeExtraIndex
224+
.. index:: single: _PyEval_RequestCodeExtraIndex (C function)
225225
226226
.. versionadded:: 3.6 as ``_PyEval_RequestCodeExtraIndex``
227227
@@ -239,7 +239,7 @@ may change without deprecation warnings.
239239
If no data was set under the index, set *extra* to ``NULL`` and return
240240
0 without setting an exception.
241241
242-
.. index:: single: _PyCode_GetExtra
242+
.. index:: single: _PyCode_GetExtra (C function)
243243
244244
.. versionadded:: 3.6 as ``_PyCode_GetExtra``
245245
@@ -254,7 +254,7 @@ may change without deprecation warnings.
254254
Set the extra data stored under the given index to *extra*.
255255
Return 0 on success. Set an exception and return -1 on failure.
256256
257-
.. index:: single: _PyCode_SetExtra
257+
.. index:: single: _PyCode_SetExtra (C function)
258258
259259
.. versionadded:: 3.6 as ``_PyCode_SetExtra``
260260

Doc/c-api/exceptions.rst

Lines changed: 70 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ For convenience, some of these functions will always return a
180180
181181
.. c:function:: PyObject* PyErr_SetFromErrno(PyObject *type)
182182
183-
.. index:: single: strerror()
183+
.. index:: single: strerror (C function)
184184
185185
This is a convenience function to raise an exception when a C library function
186186
has returned an error and set the C variable :c:data:`errno`. It constructs a
@@ -635,7 +635,7 @@ Signal Handling
635635
636636
.. index::
637637
pair: module; signal
638-
single: SIGINT
638+
single: SIGINT (C macro)
639639
single: KeyboardInterrupt (built-in exception)
640640
641641
This function interacts with Python's signal handling.
@@ -666,7 +666,7 @@ Signal Handling
666666
667667
.. index::
668668
pair: module; signal
669-
single: SIGINT
669+
single: SIGINT (C macro)
670670
single: KeyboardInterrupt (built-in exception)
671671
672672
Simulate the effect of a :c:macro:`!SIGINT` signal arriving.
@@ -968,59 +968,59 @@ All standard Python exceptions are available as global variables whose names are
968968
the variables:
969969
970970
.. index::
971-
single: PyExc_BaseException
972-
single: PyExc_Exception
973-
single: PyExc_ArithmeticError
974-
single: PyExc_AssertionError
975-
single: PyExc_AttributeError
976-
single: PyExc_BlockingIOError
977-
single: PyExc_BrokenPipeError
978-
single: PyExc_BufferError
979-
single: PyExc_ChildProcessError
980-
single: PyExc_ConnectionAbortedError
981-
single: PyExc_ConnectionError
982-
single: PyExc_ConnectionRefusedError
983-
single: PyExc_ConnectionResetError
984-
single: PyExc_EOFError
985-
single: PyExc_FileExistsError
986-
single: PyExc_FileNotFoundError
987-
single: PyExc_FloatingPointError
988-
single: PyExc_GeneratorExit
989-
single: PyExc_ImportError
990-
single: PyExc_IndentationError
991-
single: PyExc_IndexError
992-
single: PyExc_InterruptedError
993-
single: PyExc_IsADirectoryError
994-
single: PyExc_KeyError
995-
single: PyExc_KeyboardInterrupt
996-
single: PyExc_LookupError
997-
single: PyExc_MemoryError
998-
single: PyExc_ModuleNotFoundError
999-
single: PyExc_NameError
1000-
single: PyExc_NotADirectoryError
1001-
single: PyExc_NotImplementedError
1002-
single: PyExc_OSError
1003-
single: PyExc_OverflowError
1004-
single: PyExc_PermissionError
1005-
single: PyExc_ProcessLookupError
1006-
single: PyExc_RecursionError
1007-
single: PyExc_ReferenceError
1008-
single: PyExc_RuntimeError
1009-
single: PyExc_StopAsyncIteration
1010-
single: PyExc_StopIteration
1011-
single: PyExc_SyntaxError
1012-
single: PyExc_SystemError
1013-
single: PyExc_SystemExit
1014-
single: PyExc_TabError
1015-
single: PyExc_TimeoutError
1016-
single: PyExc_TypeError
1017-
single: PyExc_UnboundLocalError
1018-
single: PyExc_UnicodeDecodeError
1019-
single: PyExc_UnicodeEncodeError
1020-
single: PyExc_UnicodeError
1021-
single: PyExc_UnicodeTranslateError
1022-
single: PyExc_ValueError
1023-
single: PyExc_ZeroDivisionError
971+
single: PyExc_BaseException (C var)
972+
single: PyExc_Exception (C var)
973+
single: PyExc_ArithmeticError (C var)
974+
single: PyExc_AssertionError (C var)
975+
single: PyExc_AttributeError (C var)
976+
single: PyExc_BlockingIOError (C var)
977+
single: PyExc_BrokenPipeError (C var)
978+
single: PyExc_BufferError (C var)
979+
single: PyExc_ChildProcessError (C var)
980+
single: PyExc_ConnectionAbortedError (C var)
981+
single: PyExc_ConnectionError (C var)
982+
single: PyExc_ConnectionRefusedError (C var)
983+
single: PyExc_ConnectionResetError (C var)
984+
single: PyExc_EOFError (C var)
985+
single: PyExc_FileExistsError (C var)
986+
single: PyExc_FileNotFoundError (C var)
987+
single: PyExc_FloatingPointError (C var)
988+
single: PyExc_GeneratorExit (C var)
989+
single: PyExc_ImportError (C var)
990+
single: PyExc_IndentationError (C var)
991+
single: PyExc_IndexError (C var)
992+
single: PyExc_InterruptedError (C var)
993+
single: PyExc_IsADirectoryError (C var)
994+
single: PyExc_KeyError (C var)
995+
single: PyExc_KeyboardInterrupt (C var)
996+
single: PyExc_LookupError (C var)
997+
single: PyExc_MemoryError (C var)
998+
single: PyExc_ModuleNotFoundError (C var)
999+
single: PyExc_NameError (C var)
1000+
single: PyExc_NotADirectoryError (C var)
1001+
single: PyExc_NotImplementedError (C var)
1002+
single: PyExc_OSError (C var)
1003+
single: PyExc_OverflowError (C var)
1004+
single: PyExc_PermissionError (C var)
1005+
single: PyExc_ProcessLookupError (C var)
1006+
single: PyExc_RecursionError (C var)
1007+
single: PyExc_ReferenceError (C var)
1008+
single: PyExc_RuntimeError (C var)
1009+
single: PyExc_StopAsyncIteration (C var)
1010+
single: PyExc_StopIteration (C var)
1011+
single: PyExc_SyntaxError (C var)
1012+
single: PyExc_SystemError (C var)
1013+
single: PyExc_SystemExit (C var)
1014+
single: PyExc_TabError (C var)
1015+
single: PyExc_TimeoutError (C var)
1016+
single: PyExc_TypeError (C var)
1017+
single: PyExc_UnboundLocalError (C var)
1018+
single: PyExc_UnicodeDecodeError (C var)
1019+
single: PyExc_UnicodeEncodeError (C var)
1020+
single: PyExc_UnicodeError (C var)
1021+
single: PyExc_UnicodeTranslateError (C var)
1022+
single: PyExc_ValueError (C var)
1023+
single: PyExc_ZeroDivisionError (C var)
10241024
10251025
+-----------------------------------------+---------------------------------+----------+
10261026
| C Name | Python Name | Notes |
@@ -1151,9 +1151,9 @@ the variables:
11511151
These are compatibility aliases to :c:data:`PyExc_OSError`:
11521152
11531153
.. index::
1154-
single: PyExc_EnvironmentError
1155-
single: PyExc_IOError
1156-
single: PyExc_WindowsError
1154+
single: PyExc_EnvironmentError (C var)
1155+
single: PyExc_IOError (C var)
1156+
single: PyExc_WindowsError (C var)
11571157
11581158
+-------------------------------------+----------+
11591159
| C Name | Notes |
@@ -1188,17 +1188,17 @@ names are ``PyExc_`` followed by the Python exception name. These have the type
11881188
the variables:
11891189
11901190
.. index::
1191-
single: PyExc_Warning
1192-
single: PyExc_BytesWarning
1193-
single: PyExc_DeprecationWarning
1194-
single: PyExc_FutureWarning
1195-
single: PyExc_ImportWarning
1196-
single: PyExc_PendingDeprecationWarning
1197-
single: PyExc_ResourceWarning
1198-
single: PyExc_RuntimeWarning
1199-
single: PyExc_SyntaxWarning
1200-
single: PyExc_UnicodeWarning
1201-
single: PyExc_UserWarning
1191+
single: PyExc_Warning (C var)
1192+
single: PyExc_BytesWarning (C var)
1193+
single: PyExc_DeprecationWarning (C var)
1194+
single: PyExc_FutureWarning (C var)
1195+
single: PyExc_ImportWarning (C var)
1196+
single: PyExc_PendingDeprecationWarning (C var)
1197+
single: PyExc_ResourceWarning (C var)
1198+
single: PyExc_RuntimeWarning (C var)
1199+
single: PyExc_SyntaxWarning (C var)
1200+
single: PyExc_UnicodeWarning (C var)
1201+
single: PyExc_UserWarning (C var)
12021202
12031203
+------------------------------------------+---------------------------------+----------+
12041204
| C Name | Python Name | Notes |

Doc/c-api/file.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ the :mod:`io` APIs instead.
9696
9797
.. c:function:: int PyFile_WriteObject(PyObject *obj, PyObject *p, int flags)
9898
99-
.. index:: single: Py_PRINT_RAW
99+
.. index:: single: Py_PRINT_RAW (C macro)
100100
101101
Write object *obj* to file object *p*. The only supported flag for *flags* is
102102
:c:macro:`Py_PRINT_RAW`; if given, the :func:`str` of the object is written

Doc/c-api/init.rst

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ Initializing and finalizing the interpreter
332332
pair: module; __main__
333333
pair: module; sys
334334
triple: module; search; path
335-
single: Py_FinalizeEx()
335+
single: Py_FinalizeEx (C function)
336336
337337
Initialize the Python interpreter. In an application embedding Python,
338338
this should be called before using any other Python/C API functions; see
@@ -661,7 +661,7 @@ operations could cause problems in a multi-threaded program: for example, when
661661
two threads simultaneously increment the reference count of the same object, the
662662
reference count could end up being incremented only once instead of twice.
663663
664-
.. index:: single: setswitchinterval() (in module sys)
664+
.. index:: single: setswitchinterval (in module sys)
665665
666666
Therefore, the rule exists that only the thread that has acquired the
667667
:term:`GIL` may operate on Python objects or call Python/C API functions.
@@ -671,8 +671,7 @@ released around potentially blocking I/O operations like reading or writing
671671
a file, so that other Python threads can run in the meantime.
672672
673673
.. index::
674-
single: PyThreadState
675-
single: PyThreadState
674+
single: PyThreadState (C type)
676675
677676
The Python interpreter keeps some thread-specific bookkeeping information
678677
inside a data structure called :c:type:`PyThreadState`. There's also one
@@ -698,8 +697,8 @@ This is so common that a pair of macros exists to simplify it::
698697
Py_END_ALLOW_THREADS
699698
700699
.. index::
701-
single: Py_BEGIN_ALLOW_THREADS
702-
single: Py_END_ALLOW_THREADS
700+
single: Py_BEGIN_ALLOW_THREADS (C macro)
701+
single: Py_END_ALLOW_THREADS (C macro)
703702
704703
The :c:macro:`Py_BEGIN_ALLOW_THREADS` macro opens a new block and declares a
705704
hidden local variable; the :c:macro:`Py_END_ALLOW_THREADS` macro closes the
@@ -714,8 +713,8 @@ The block above expands to the following code::
714713
PyEval_RestoreThread(_save);
715714
716715
.. index::
717-
single: PyEval_RestoreThread()
718-
single: PyEval_SaveThread()
716+
single: PyEval_RestoreThread (C function)
717+
single: PyEval_SaveThread (C function)
719718
720719
Here is how these functions work: the global interpreter lock is used to protect the pointer to the
721720
current thread state. When releasing the lock and saving the thread state,
@@ -1399,8 +1398,8 @@ function. You can create and destroy them using the following functions:
13991398
may be stored internally on the :c:type:`PyInterpreterState`.
14001399
14011400
.. index::
1402-
single: Py_FinalizeEx()
1403-
single: Py_Initialize()
1401+
single: Py_FinalizeEx (C function)
1402+
single: Py_Initialize (C function)
14041403
14051404
Extension modules are shared between (sub-)interpreters as follows:
14061405
@@ -1428,7 +1427,7 @@ function. You can create and destroy them using the following functions:
14281427
As with multi-phase initialization, this means that only C-level static
14291428
and global variables are shared between these modules.
14301429
1431-
.. index:: single: close() (in module os)
1430+
.. index:: single: close (in module os)
14321431
14331432
14341433
.. c:function:: PyThreadState* Py_NewInterpreter(void)
@@ -1451,7 +1450,7 @@ function. You can create and destroy them using the following functions:
14511450
14521451
.. c:function:: void Py_EndInterpreter(PyThreadState *tstate)
14531452
1454-
.. index:: single: Py_FinalizeEx()
1453+
.. index:: single: Py_FinalizeEx (C function)
14551454
14561455
Destroy the (sub-)interpreter represented by the given thread state.
14571456
The given thread state must be the current thread state. See the
@@ -1543,8 +1542,6 @@ pointer and a void pointer argument.
15431542
15441543
.. c:function:: int Py_AddPendingCall(int (*func)(void *), void *arg)
15451544
1546-
.. index:: single: Py_AddPendingCall()
1547-
15481545
Schedule a function to be called from the main interpreter thread. On
15491546
success, ``0`` is returned and *func* is queued for being called in the
15501547
main thread. On failure, ``-1`` is returned without setting any exception.

0 commit comments

Comments
 (0)
0