Skip to content

Commit 8ce3d7d

Browse files
committed
Various terminology changes.
1 parent 48b145a commit 8ce3d7d

File tree

5 files changed

+25
-24
lines changed

5 files changed

+25
-24
lines changed

Doc/c-api/init.rst

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -963,7 +963,7 @@ a file, so that other Python threads can run in the meantime.
963963
964964
The Python interpreter keeps some thread-specific bookkeeping information
965965
inside a data structure called :c:type:`PyThreadState`, known as a :term:`thread state`.
966-
There's also one :term:`thread-local variable <active thread state>` pointing to the
966+
There's also one :term:`thread-local variable <current thread state>` pointing to the
967967
current :c:type:`PyThreadState`: it can be retrieved using :c:func:`PyThreadState_Get`.
968968
969969
A thread can only have one :term:`attached thread state` at a time. An attached
@@ -1204,13 +1204,13 @@ code, or when embedding the Python interpreter:
12041204
12051205
.. c:function:: PyThreadState* PyEval_SaveThread()
12061206
1207-
Detach the :term:`active thread state` (if it has been created) and
1207+
Detach the :term:`current thread state` (if it has been created) and
12081208
return it.
12091209
12101210
12111211
.. c:function:: void PyEval_RestoreThread(PyThreadState *tstate)
12121212
1213-
Set the :term:`active thread state` to *tstate*, which must not be ``NULL``.
1213+
Set the :term:`current thread state` to *tstate*, which must not be ``NULL``.
12141214
The passed :term:`thread state` **should not** be :term:`attached <attached thread state>`,
12151215
otherwise deadlock ensues.
12161216
@@ -1226,7 +1226,7 @@ code, or when embedding the Python interpreter:
12261226
12271227
.. c:function:: PyThreadState* PyThreadState_Get()
12281228
1229-
Return the :term:`active thread state`. If the :term:`active thread state` is ``NULL``
1229+
Return the :term:`current thread state`. If the :term:`current thread state` is ``NULL``
12301230
(such as when inside of :c:macro:`Py_BEGIN_ALLOW_THREADS` block), then this issues a fatal
12311231
error (so that the caller needn't check for ``NULL``).
12321232
@@ -1246,13 +1246,13 @@ code, or when embedding the Python interpreter:
12461246
12471247
.. c:function:: PyThreadState* PyThreadState_Swap(PyThreadState *tstate)
12481248
1249-
Set the :term:`active thread state` to *tstate*, and return
1249+
Set the :term:`current thread state` to *tstate*, and return
12501250
the old value.
12511251
12521252
If there is an :term:`attached thread state` for the current
12531253
thread, it will be detached. Upon returning from this function,
12541254
*tstate* will become :term:`attached <attached thread state>` instead
1255-
if it's not ``NULL``. If it is ``NULL``, then the :term:`active thread state`
1255+
if it's not ``NULL``. If it is ``NULL``, then the :term:`current thread state`
12561256
will be ``NULL``.
12571257
12581258
@@ -1304,7 +1304,7 @@ with sub-interpreters:
13041304
13051305
.. c:function:: PyThreadState* PyGILState_GetThisThreadState()
13061306
1307-
Get the :term:`active thread state` for this thread. May return ``NULL`` if no
1307+
Get the :term:`current thread state` for this thread. May return ``NULL`` if no
13081308
GILState API has been used on the current thread. Note that the main thread
13091309
always has such a thread-state, even if no auto-thread-state call has been
13101310
made on the main thread. This is mainly a helper/diagnostic function.
@@ -1419,7 +1419,7 @@ All of the following functions must be called after :c:func:`Py_Initialize`.
14191419
14201420
.. c:function:: void PyThreadState_DeleteCurrent(void)
14211421
1422-
Destroy the :term:`attached thread state` and set the :term:`active thread state`
1422+
Destroy the :term:`attached thread state` and set the :term:`current thread state`
14231423
to ``NULL``. The :term:`thread state <attached thread state>` must have been reset
14241424
with a previous call to :c:func:`PyThreadState_Clear`.
14251425

Doc/c-api/sys.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -346,8 +346,8 @@ accessible to C code. They all work with the current interpreter thread's
346346
silently abort the operation by raising an error subclassed from
347347
:class:`Exception` (other errors will not be silenced).
348348
349-
The hook function is always called with a :term:`thread state` by the Python
350-
interpreter that raised the event.
349+
The hook function is always called with an :term:`attached thread state` by
350+
the Python interpreter that raised the event.
351351
352352
See :pep:`578` for a detailed description of auditing. Functions in the
353353
runtime and standard library that raise events are listed in the

Doc/c-api/time.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ require the caller to have an :term:`attached thread state`.
8383
On success, the functions return ``0``.
8484
8585
On failure, they set ``*result`` to ``0`` and return ``-1``, *without* setting
86-
an exception. To get the cause of the error, attach a :term:`thread state`, and call the
87-
regular (non-``Raw``) function. Note that the regular function may succeed after
86+
an exception. To get the cause of the error, :term:`attach <attached thread state>` a :term:`thread state`,
87+
and call the regular (non-``Raw``) function. Note that the regular function may succeed after
8888
the ``Raw`` one failed.
8989
9090
.. c:function:: int PyTime_MonotonicRaw(PyTime_t *result)

Doc/glossary.rst

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,6 @@ Glossary
3636
and loaders (in the :mod:`importlib.abc` module). You can create your own
3737
ABCs with the :mod:`abc` module.
3838

39-
active thread state
40-
41-
The :c:data:`PyThreadState` pointer to a :term:`thread state` for the current thread.
42-
The per-thread pointer might be ``NULL``, in which case Python code should not
43-
get executed. If the active thread state is non-``NULL``, then the :term:`thread state`
44-
that it points to is considered to be :term:`attached <attached thread state>`.
45-
4639
annotate function
4740
A function that can be called to retrieve the :term:`annotations <annotation>`
4841
of an object. This function is accessible as the :attr:`~object.__annotate__`
@@ -141,10 +134,11 @@ Glossary
141134

142135
attached thread state
143136

144-
A :term:`thread state` that is :term:`active <active thread state>`
145-
for the current thread.
137+
A :term:`thread state` that is :term:`active <current thread state>`
138+
for the current thread. If no thread state is attached, then the
139+
:term:`current thread state` is ``NULL``.
146140

147-
On most builds of Python, an attached thread state means that the
141+
On most builds of Python, having an attached thread state means that the
148142
caller holds the :term:`GIL` for the current interpreter.
149143

150144
attribute
@@ -348,6 +342,13 @@ Glossary
348342
tasks (see :mod:`asyncio`) associate each task with a context which
349343
becomes the current context whenever the task starts or resumes execution.
350344

345+
current thread state
346+
347+
The :c:data:`PyThreadState` pointer to a :term:`thread state` for the current thread.
348+
The per-thread pointer might be ``NULL``, in which case Python code should not
349+
get executed. If the current thread state is non-``NULL``, then the :term:`thread state`
350+
that it points to is considered to be :term:`attached <attached thread state>`.
351+
351352
decorator
352353
A function returning another function, usually applied as a function
353354
transformation using the ``@wrapper`` syntax. Common examples for
@@ -1303,7 +1304,7 @@ Glossary
13031304
thread state
13041305
In Python's C API, a thread state is a structure that holds
13051306
information about the current thread. A thread state must be
1306-
:term:`active <active thread state>` for the current thread in order to call most of the C API.
1307+
:term:`active <current thread state>` for the current thread in order to call most of the C API.
13071308

13081309
See :ref:`Thread State and the Global Interpreter Lock <threads>` for more
13091310
information.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
Improve error message when calling the C API without an active thread state
1+
Improve error message when calling the C API without an current thread state
22
on the :term:`free-threaded <free threading>` build.

0 commit comments

Comments
 (0)