@@ -1094,7 +1094,7 @@ acquire the :term:`GIL`.
10941094If any thread, other than the finalization thread, attempts to acquire the GIL
10951095during finalization, either explicitly via :c:func:`PyGILState_Ensure`,
10961096:c:macro:`Py_END_ALLOW_THREADS`, :c:func:`PyEval_AcquireThread`, or
1097- :c:func:`PyEval_AcquireLock`, or implicitly when the interpreter attempts to
1097+ :c:func:`! PyEval_AcquireLock`, or implicitly when the interpreter attempts to
10981098reacquire it after having yielded it, the thread enters **a permanently blocked
10991099state** where it remains until the program exits. In most cases this is
11001100harmless, but this can result in deadlock if a later stage of finalization
@@ -1228,6 +1228,19 @@ code, or when embedding the Python interpreter:
12281228The following functions use thread-local storage, and are not compatible
12291229with sub-interpreters:
12301230
1231+ .. c:type:: PyGILState_STATE
1232+
1233+ The type of the value returned by :c:func:`PyGILState_Ensure` and passed to
1234+ :c:func:`PyGILState_Release`.
1235+
1236+ .. c:enumerator:: PyGILState_LOCKED
1237+
1238+ The GIL was already held when :c:func:`PyGILState_Ensure` was called.
1239+
1240+ .. c:enumerator:: PyGILState_UNLOCKED
1241+
1242+ The GIL was not held when :c:func:`PyGILState_Ensure` was called.
1243+
12311244.. c:function:: PyGILState_STATE PyGILState_Ensure()
12321245
12331246 Ensure that the current thread is ready to call the Python C API regardless
@@ -1372,11 +1385,11 @@ All of the following functions must be called after :c:func:`Py_Initialize`.
13721385 must be held.
13731386
13741387 .. versionchanged:: 3.9
1375- This function now calls the :c:member:`PyThreadState.on_delete` callback.
1388+ This function now calls the :c:member:`! PyThreadState.on_delete` callback.
13761389 Previously, that happened in :c:func:`PyThreadState_Delete`.
13771390
13781391 .. versionchanged:: 3.13
1379- The :c:member:`PyThreadState.on_delete` callback was removed.
1392+ The :c:member:`! PyThreadState.on_delete` callback was removed.
13801393
13811394
13821395.. c:function:: void PyThreadState_Delete(PyThreadState *tstate)
0 commit comments