Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f1dfe73

Browse files
committed
Improve description of issues
1 parent 8b50b83 commit f1dfe73

1 file changed

Lines changed: 10 additions & 7 deletions

File tree

Doc/c-api/init.rst

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -861,13 +861,16 @@ in one sub-interpreter into a namespace of another sub-interpreter; this should
861861
be done with great care to avoid sharing user-defined functions, methods,
862862
instances or classes between sub-interpreters, since import operations executed
863863
by such objects may affect the wrong (sub-)interpreter's dictionary of loaded
864-
modules. (XXX This is a hard-to-fix bug that will be addressed in a future
865-
release.)
866-
867-
Also note that the use of this functionality is incompatible with extension
868-
modules such as PyObjC and ctypes that use the :c:func:`PyGILState_\*` APIs (and
869-
this is inherent in the way the :c:func:`PyGILState_\*` functions work). Simple
870-
things may work, but confusing behavior will always be near.
864+
modules.
865+
866+
Also note that combining this functionality with :c:func:`PyGILState_\*` APIs
867+
is delicate, become these APIs assume a bijection between Python thread states
868+
and OS-level threads, an assumption broken by the presence of sub-interpreters.
869+
It is highly recommended that you don't switch sub-interpreters between a pair
870+
of matching :c:func:`PyGILState_Ensure` and :c:func:`PyGILState_Release` calls.
871+
Furthermore, extensions (such as :mod:`ctypes`) using these APIs to allow calling
872+
of Python code from non-Python created threads will probably be broken when using
873+
sub-interpreters.
871874
872875
873876
Asynchronous Notifications

0 commit comments

Comments
 (0)