bpo-39947: Add PyThreadState_GetInterpreter() (GH-18981)

Add PyThreadState_GetInterpreter(tstate): get the interpreter of a
Python thread state.
This commit is contained in:
Victor Stinner 2020-03-13 23:38:08 +01:00 committed by GitHub
parent be79373a78
commit 8fb02b6e19
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 37 additions and 9 deletions

View file

@ -1064,12 +1064,21 @@ All of the following functions must be called after :c:func:`Py_Initialize`.
:c:func:`PyThreadState_Clear`.
.. c:function:: void PyThreadState_DeleteCurrent()
.. c:function:: void PyThreadState_DeleteCurrent(void)
Destroy the current thread state and release the global interpreter lock.
Like :c:func:`PyThreadState_Delete`, the global interpreter lock need not
be held. The thread state must have been reset with a previous call
to :c:func:`PyThreadState_Clear`.
Destroy the current thread state and release the global interpreter lock.
Like :c:func:`PyThreadState_Delete`, the global interpreter lock need not
be held. The thread state must have been reset with a previous call
to :c:func:`PyThreadState_Clear`.
.. c:function:: PyInterpreterState* PyThreadState_GetInterpreter(PyThreadState *tstate)
Get the interpreter of the Python thread state *tstate*.
*tstate* must not be ``NULL``.
.. versionadded:: 3.9
.. c:function:: PyInterpreterState* PyInterpreterState_Get(void)