Skip to content

Commit 541169d

Browse files
committed
Fix failure note + use affirmative tone in PyInterpreterView_FromMain docs.
1 parent 7aa2f65 commit 541169d

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

Doc/c-api/interp-lifecycle.rst

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -763,14 +763,14 @@ deleted. This can be done using interpreter views.
763763
764764
On success, this function returns a view to the main
765765
interpreter; on failure, it returns ``NULL`` without an exception set.
766-
Failure indicates that the process is out of memory or that the main
767-
interpreter has finalized (or never existed).
768-
769-
Using this function in extension libraries is strongly discouraged, because
770-
it typically compromises the library's subinterpreter support. It exists
771-
for exceptional cases where there is no other option (such as when a native
772-
threading library doesn't provide a ``void *arg`` parameter that could be
773-
used to store a ``PyInterpreterGuard`` or ``PyInterpreterView`` pointer).
766+
Failure indicates that the process is out of memory.
767+
768+
Use this function when an interpreter pointer or view cannot be supplied
769+
by the caller, such as when a native threading library does not provide a
770+
``void *arg`` parameter that could carry a :c:type:`PyInterpreterGuard` or
771+
:c:type:`PyInterpreterView`. In code that supports subinterpreters, prefer
772+
:c:func:`PyInterpreterView_FromCurrent` so the guard tracks the calling
773+
interpreter rather than the main one.
774774
775775
The caller does not need to hold an :term:`attached thread state`.
776776

0 commit comments

Comments
 (0)