Skip to content

Commit 905ca5b

Browse files
committed
Change some phrasing.
1 parent e5f1d18 commit 905ca5b

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

Doc/c-api/init.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1411,7 +1411,7 @@ All of the following functions must be called after :c:func:`Py_Initialize`.
14111411
14121412
.. c:function:: void PyThreadState_Delete(PyThreadState *tstate)
14131413
1414-
Destroy a :term:`thread state`` object. *tstate* should not
1414+
Destroy a :term:`thread state` object. *tstate* should not
14151415
be :term:`attached <attached thread state>` to any thread.
14161416
*tstate* must have been reset with a previous call to
14171417
:c:func:`PyThreadState_Clear`.

Doc/glossary.rst

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -137,10 +137,12 @@ Glossary
137137
A :term:`thread state` that is :term:`active <current thread state>`
138138
for the current thread. If no thread state is attached, then the
139139
:term:`current thread state` is ``NULL``. Attempting to call Python
140-
without an attached thread state will generally result in a fatal error.
140+
without an attached thread state will result in a fatal error.
141141

142142
A thread state can be attached and detached explicitly by the user, or
143-
implicitly by the interpreter.
143+
implicitly by the interpreter in between calls. For example, an attached
144+
thread state is detached upon entering a :c:macro:`Py_BEGIN_ALLOW_THREADS`
145+
block, and then re-attached when :c:macro:`Py_END_ALLOW_THREADS` is reached.
144146

145147
On most builds of Python, having an attached thread state means that the
146148
caller holds the :term:`GIL` for the current interpreter.
@@ -348,10 +350,15 @@ Glossary
348350

349351
current thread state
350352

351-
The :c:data:`PyThreadState` pointer to a :term:`thread state` for the current thread.
352-
The per-thread pointer might be ``NULL``, in which case Python code should not
353-
get executed. If the current thread state is non-``NULL``, then the :term:`thread state`
354-
that it points to is considered to be :term:`attached <attached thread state>`.
353+
A per-thread :c:data:`PyThreadState` pointer for the current thread.
354+
The pointer might be ``NULL``, in which case Python code should not
355+
get executed.
356+
357+
If the current thread state is non-``NULL``, then the :term:`thread state`
358+
that it points to is considered to be :term:`attached <attached thread state>`.
359+
360+
The per-thread pointer can be acquired via :c:func:`PyThreadState_Get` or
361+
:c:func:`PyThreadState_GetUnchecked` if it might be ``NULL``.
355362

356363
decorator
357364
A function returning another function, usually applied as a function

0 commit comments

Comments
 (0)