@@ -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