File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -855,6 +855,12 @@ code, or when embedding the Python interpreter:
855855 created, the current thread must not have acquired it, otherwise deadlock
856856 ensues.
857857
858+ .. warning::
859+ Calling this function from a thread when the interpreter is finalizing
860+ will terminate the thread, even if the thread was not created by Python.
861+ You can use :c:func:`_Py_IsFinalizing` or :func:`sys.is_finalizing` to
862+ check if the interpreter is in process of being finalized before calling
863+ this function to avoid unwanted termination.
858864
859865.. c:function:: PyThreadState* PyThreadState_Get()
860866
@@ -902,6 +908,12 @@ with sub-interpreters:
902908 When the function returns, the current thread will hold the GIL and be able
903909 to call arbitrary Python code. Failure is a fatal error.
904910
911+ .. warning::
912+ Calling this function from a thread when the interpreter is finalizing
913+ will terminate the thread, even if the thread was not created by Python.
914+ You can use :c:func:`_Py_IsFinalizing` or :func:`sys.is_finalizing` to
915+ check if the interpreter is in process of being finalized before calling
916+ this function to avoid unwanted termination.
905917
906918.. c:function:: void PyGILState_Release(PyGILState_STATE)
907919
You can’t perform that action at this time.
0 commit comments