File tree 1 file changed +12
-0
lines changed 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:
855
855
created, the current thread must not have acquired it, otherwise deadlock
856
856
ensues.
857
857
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.
858
864
859
865
.. c:function:: PyThreadState* PyThreadState_Get()
860
866
@@ -902,6 +908,12 @@ with sub-interpreters:
902
908
When the function returns, the current thread will hold the GIL and be able
903
909
to call arbitrary Python code. Failure is a fatal error.
904
910
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.
905
917
906
918
.. c:function:: void PyGILState_Release(PyGILState_STATE)
907
919
You can’t perform that action at this time.
0 commit comments