@@ -115,8 +115,8 @@ is severely limiting for users who want to do more than just execute Python
115115code in their stream of calls (for example, C++ executing finalizers in
116116*addition * to calling Python).
117117
118- Using :c:func: ` Py_IsFinalizing ` is insufficient
119- ***********************************************
118+ Using `` Py_IsFinalizing ` ` is insufficient
119+ *****************************************
120120
121121The :ref: `docs <python:gilstate >`
122122currently recommend :c:func: `Py_IsFinalizing ` to guard against termination of
@@ -167,8 +167,8 @@ finalization, because a daemon thread got hung while holding the lock. There
167167are workarounds for this for pure-Python code, but native threads don't have
168168such an option.
169169
170- We can't change finalization behavior for :c:func: ` PyGILState_Ensure `
171- *********************************************************************
170+ We can't change finalization behavior for `` PyGILState_Ensure ` `
171+ ***************************************************************
172172
173173There will always have to be a point in a Python program where
174174:c:func: `PyGILState_Ensure ` can no longer acquire the GIL (or more correctly,
@@ -193,8 +193,8 @@ There are currently two public ways for a user to create and attach their own
193193and :c:func: `PyGILState_Ensure `. The latter, :c:func: `PyGILState_Ensure `,
194194is `significantly more common <https://grep.app/search?q=pygilstate_ensure >`_.
195195
196- :c:func: ` PyGILState_Ensure ` generally crashes during finalization
197- *****************************************************************
196+ `` PyGILState_Ensure ` ` generally crashes during finalization
197+ ***********************************************************
198198
199199At the time of writing, the current behavior of :c:func: `PyGILState_Ensure ` does not
200200match the documentation. Instead of hanging the thread during finalization
@@ -217,15 +217,15 @@ created by the authors of this PEP:
217217 omit ``PyGILState_Ensure `` in fresh threads.
218218
219219Since Python 3.12, it is an :term: `attached thread state ` that lets a thread
220- invoke the C API. On with-GIL builds, holding an :term: ` attached thread state `
220+ invoke the C API. On with-GIL builds, holding an attached thread state
221221implies holding the GIL, so only one thread can have one at a time. Free-threaded
222222builds achieve the effect of multi-core parallism while remaining
223223ackwards-compatible by simply removing that limitation: threads still need a
224224thread state (and thus need to call :c:func: `PyGILState_Ensure `), but they
225225don't need to wait on one another to do so.
226226
227- Subinterpreters don't work with :c:func: ` PyGILState_Ensure `
228- -----------------------------------------------------------
227+ Subinterpreters don't work with `` PyGILState_Ensure ` `
228+ -----------------------------------------------------
229229
230230As noted in the :ref: `documentation <python:gilstate >`,
231231``PyGILState `` APIs aren't officially supported in subinterpreters:
@@ -443,12 +443,12 @@ replace :c:func:`PyGILState_Ensure` and :c:func:`PyGILState_Release`.
443443
444444 Thread states created by this function are non-daemon by default. See
445445 :c:func: `PyThreadState_SetDaemon `. If the calling thread already has an
446- :term: ` attached thread state ` that matches *interp *, then this function
446+ attached thread state that matches *interp *, then this function
447447 will mark the existing thread state as non-daemon and return. It will
448448 be restored to its prior daemon status upon the next
449449 :c:func: `PyThreadState_Release ` call.
450450
451- Return zero on success, and non-zero with the old :term: ` attached thread state `
451+ Return zero on success, and non-zero with the old attached thread state
452452 restored (which may have been ``NULL ``).
453453
454454.. c:function:: void PyThreadState_Release()
@@ -457,7 +457,7 @@ replace :c:func:`PyGILState_Ensure` and :c:func:`PyGILState_Release`.
457457 :c:func:`PyThreadState_Ensure`.
458458
459459 This function cannot fail, but may hang the thread if the
460- :term:` attached thread state` prior to the original :c:func:`PyThreadState_Ensure`
460+ attached thread state prior to the original :c:func:`! PyThreadState_Ensure`
461461 was daemon and the interpreter was finalized.
462462
463463Deprecation of ``PyGILState`` APIs
@@ -653,7 +653,7 @@ they can still be used with this API:
653653 Asynchronous callback example
654654*****************************
655655
656- As started in the Motivation _, there are many cases where it's desirable
656+ As stated in the Motivation _, there are many cases where it's desirable
657657to call Python in an asynchronous callback, such as a signal handler. In that
658658case, it's not safe to call :c:func: `PyInterpreterState_Hold `, because it's
659659not guaranteed that :c:func: `PyThreadState_Ensure ` will ever be called, which
@@ -718,8 +718,8 @@ A reference implementation of this PEP can be found
718718Rejected Ideas
719719==============
720720
721- Using an interpreter ID instead of a interpreter state for :c:func: ` PyThreadState_Ensure `
722- -----------------------------------------------------------------------------------------
721+ Using an interpreter ID instead of a interpreter state for `` PyThreadState_Ensure ` `
722+ -----------------------------------------------------------------------------------
723723
724724Some iterations of this API took an ``int64_t interp_id `` parameter instead of
725725``PyInterpreterState *interp ``, because interpreter IDs cannot be concurrently
@@ -773,8 +773,8 @@ This was ultimately rejected for two reasons:
773773 for code-generators like Cython to use, as there isn't any additional
774774 complexity with tracking :c:type: `PyThreadState ` pointers around.
775775
776- Using ``PyStatus `` for the return value of :c:func: ` PyThreadState_Ensure `
777- -------------------------------------------------------------------------
776+ Using ``PyStatus `` for the return value of `` PyThreadState_Ensure ` `
777+ -------------------------------------------------------------------
778778
779779In prior iterations of this API, :c:func: `PyThreadState_Ensure ` returned a
780780:c:type: `PyStatus ` instead of an integer to denote failures, which had the
0 commit comments