@@ -608,7 +608,8 @@ it possible to avoid these issues by temporarily preventing finalization:
608608
609609.. seealso::
610610
611- :pep:`788`
611+ :pep:`788` explains the design, motivation and rationale
612+ for these APIs.
612613
613614.. c:type:: PyInterpreterGuard
614615
@@ -624,14 +625,19 @@ it possible to avoid these issues by temporarily preventing finalization:
624625 guards for that interpreter. This means that if you forget to close an
625626 interpreter guard, the process will **permanently hang** during
626627 finalization!
627-
628+
629+ Holding a guard for an interpreter is similar to holding a
630+ :term:`strong reference` to a Python object, except finalization does not happen
631+ automatically after all guards are released: it requires an explicit
632+ :c:func:`Py_EndInterpreter` call.
633+
628634 .. versionadded:: next
629635
630636
631637.. c:function:: PyInterpreterGuard *PyInterpreterGuard_FromCurrent(void)
632638
633639 Create a finalization guard for the current interpreter. This will prevent
634- finalization from occuring until the guard is closed.
640+ finalization until the guard is closed.
635641
636642 For example:
637643
@@ -764,8 +770,8 @@ deleted. This can be done using interpreter views.
764770 Failure indicates that the process is out of memory or that the main
765771 interpreter has finalized (or never existed).
766772
767- Generally speaking, using this function is strongly discouraged, because
768- it typically compromises subinterpreter support for a program . It exists
773+ Using this function in extension libraries is strongly discouraged, because
774+ it typically compromises the library's subinterpreter support . It exists
769775 for exceptional cases where there is no other option (such as when a native
770776 threading library doesn't provide a ``void *arg `` parameter that could be
771777 used to store a ``PyInterpreterGuard `` or ``PyInterpreterView `` pointer).
0 commit comments