summaryrefslogtreecommitdiff
path: root/Python/pystate.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/pystate.c')
-rw-r--r--Python/pystate.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/Python/pystate.c b/Python/pystate.c
index 2fc563bf58..0a6d035836 100644
--- a/Python/pystate.c
+++ b/Python/pystate.c
@@ -159,6 +159,12 @@ _PyRuntimeState_ReInitThreads(_PyRuntimeState *runtime)
#define HEAD_UNLOCK(runtime) \
PyThread_release_lock((runtime)->interpreters.mutex)
+int
+_Py_IsMainInterpreter(PyThreadState* tstate)
+{
+ return (tstate->interp == tstate->interp->runtime->interpreters.main);
+}
+
/* Forward declaration */
static void _PyGILState_NoteThreadState(
struct _gilstate_runtime_state *gilstate, PyThreadState* tstate);