mirror of
https://github.com/python/cpython.git
synced 2025-10-16 19:57:59 +00:00
bpo-39947: Add PyThreadState_GetInterpreter() (GH-18981)
Add PyThreadState_GetInterpreter(tstate): get the interpreter of a Python thread state.
This commit is contained in:
parent
be79373a78
commit
8fb02b6e19
6 changed files with 37 additions and 9 deletions
|
@ -998,6 +998,17 @@ PyThreadState_GetDict(void)
|
|||
}
|
||||
|
||||
|
||||
PyInterpreterState *
|
||||
PyThreadState_GetInterpreter(PyThreadState *tstate)
|
||||
{
|
||||
assert(tstate != NULL);
|
||||
if (tstate == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
return tstate->interp;
|
||||
}
|
||||
|
||||
|
||||
/* Asynchronously raise an exception in a thread.
|
||||
Requested by Just van Rossum and Alex Martelli.
|
||||
To prevent naive misuse, you must write your own extension
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue