@@ -1094,7 +1094,7 @@ acquire the :term:`GIL`.
1094
1094
If any thread, other than the finalization thread, attempts to acquire the GIL
1095
1095
during finalization, either explicitly via :c:func:`PyGILState_Ensure`,
1096
1096
: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
1098
1098
reacquire it after having yielded it, the thread enters **a permanently blocked
1099
1099
state** where it remains until the program exits. In most cases this is
1100
1100
harmless, but this can result in deadlock if a later stage of finalization
@@ -1228,6 +1228,19 @@ code, or when embedding the Python interpreter:
1228
1228
The following functions use thread-local storage, and are not compatible
1229
1229
with sub-interpreters:
1230
1230
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
+
1231
1244
.. c:function:: PyGILState_STATE PyGILState_Ensure()
1232
1245
1233
1246
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`.
1372
1385
must be held.
1373
1386
1374
1387
.. 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.
1376
1389
Previously, that happened in :c:func:`PyThreadState_Delete`.
1377
1390
1378
1391
.. versionchanged:: 3.13
1379
- The :c:member:`PyThreadState.on_delete` callback was removed.
1392
+ The :c:member:`! PyThreadState.on_delete` callback was removed.
1380
1393
1381
1394
1382
1395
.. c:function:: void PyThreadState_Delete(PyThreadState *tstate)
0 commit comments