summaryrefslogtreecommitdiffstats
path: root/Doc/c-api/init.rst
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2024-02-11 10:23:30 (GMT)
committerGitHub <noreply@github.com>2024-02-11 10:23:30 (GMT)
commit573acb30f22a84c0f2c951efa002c9946e29b6a3 (patch)
tree195c75ff795a507cb6ebacf7043e364949601b10 /Doc/c-api/init.rst
parent4a08e7b3431cd32a0daf22a33421cd3035343dc4 (diff)
downloadcpython-573acb30f22a84c0f2c951efa002c9946e29b6a3.zip
cpython-573acb30f22a84c0f2c951efa002c9946e29b6a3.tar.gz
cpython-573acb30f22a84c0f2c951efa002c9946e29b6a3.tar.bz2
gh-115172: Fix explicit index extries for the C API (GH-115173)
Diffstat (limited to 'Doc/c-api/init.rst')
-rw-r--r--Doc/c-api/init.rst25
1 files changed, 11 insertions, 14 deletions
diff --git a/Doc/c-api/init.rst b/Doc/c-api/init.rst
index f8fd48e..e7199ad 100644
--- a/Doc/c-api/init.rst
+++ b/Doc/c-api/init.rst
@@ -332,7 +332,7 @@ Initializing and finalizing the interpreter
pair: module; __main__
pair: module; sys
triple: module; search; path
- single: Py_FinalizeEx()
+ single: Py_FinalizeEx (C function)
Initialize the Python interpreter. In an application embedding Python,
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
two threads simultaneously increment the reference count of the same object, the
reference count could end up being incremented only once instead of twice.
-.. index:: single: setswitchinterval() (in module sys)
+.. index:: single: setswitchinterval (in module sys)
Therefore, the rule exists that only the thread that has acquired the
: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
a file, so that other Python threads can run in the meantime.
.. index::
- single: PyThreadState
- single: PyThreadState
+ single: PyThreadState (C type)
The Python interpreter keeps some thread-specific bookkeeping information
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::
Py_END_ALLOW_THREADS
.. index::
- single: Py_BEGIN_ALLOW_THREADS
- single: Py_END_ALLOW_THREADS
+ single: Py_BEGIN_ALLOW_THREADS (C macro)
+ single: Py_END_ALLOW_THREADS (C macro)
The :c:macro:`Py_BEGIN_ALLOW_THREADS` macro opens a new block and declares a
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::
PyEval_RestoreThread(_save);
.. index::
- single: PyEval_RestoreThread()
- single: PyEval_SaveThread()
+ single: PyEval_RestoreThread (C function)
+ single: PyEval_SaveThread (C function)
Here is how these functions work: the global interpreter lock is used to protect the pointer to the
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:
may be stored internally on the :c:type:`PyInterpreterState`.
.. index::
- single: Py_FinalizeEx()
- single: Py_Initialize()
+ single: Py_FinalizeEx (C function)
+ single: Py_Initialize (C function)
Extension modules are shared between (sub-)interpreters as follows:
@@ -1428,7 +1427,7 @@ function. You can create and destroy them using the following functions:
As with multi-phase initialization, this means that only C-level static
and global variables are shared between these modules.
- .. index:: single: close() (in module os)
+ .. index:: single: close (in module os)
.. c:function:: PyThreadState* Py_NewInterpreter(void)
@@ -1451,7 +1450,7 @@ function. You can create and destroy them using the following functions:
.. c:function:: void Py_EndInterpreter(PyThreadState *tstate)
- .. index:: single: Py_FinalizeEx()
+ .. index:: single: Py_FinalizeEx (C function)
Destroy the (sub-)interpreter represented by the given thread state.
The given thread state must be the current thread state. See the
@@ -1543,8 +1542,6 @@ pointer and a void pointer argument.
.. c:function:: int Py_AddPendingCall(int (*func)(void *), void *arg)
- .. index:: single: Py_AddPendingCall()
-
Schedule a function to be called from the main interpreter thread. On
success, ``0`` is returned and *func* is queued for being called in the
main thread. On failure, ``-1`` is returned without setting any exception.