created, the current thread must not have acquired it, otherwise deadlock
ensues.
+ .. note::
+ Calling this function from a thread when the runtime is finalizing
+ will terminate the thread, even if the thread was not created by Python.
+ You can use :c:func:`_Py_IsFinalizing` or :func:`sys.is_finalizing` to
+ check if the interpreter is in process of being finalized before calling
+ this function to avoid unwanted termination.
.. c:function:: PyThreadState* PyThreadState_Get()
When the function returns, the current thread will hold the GIL and be able
to call arbitrary Python code. Failure is a fatal error.
+ .. note::
+ Calling this function from a thread when the runtime is finalizing
+ will terminate the thread, even if the thread was not created by Python.
+ You can use :c:func:`_Py_IsFinalizing` or :func:`sys.is_finalizing` to
+ check if the interpreter is in process of being finalized before calling
+ this function to avoid unwanted termination.
.. c:function:: void PyGILState_Release(PyGILState_STATE)