Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Make _Py_IsMainInterpreter inline again.
  • Loading branch information
markshannon committed Dec 7, 2021
commit 3982884a299baf93984e98bcfeb607042569383a
9 changes: 7 additions & 2 deletions Include/internal/pycore_pystate.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,13 @@ _Py_IsMainThread(void)
return (thread == _PyRuntime.main_thread);
}

extern int
_Py_IsMainInterpreter(PyInterpreterState *interp);
static inline int
_Py_IsMainInterpreter(PyInterpreterState *interp)
{
/* Use directly _PyRuntime rather than tstate->interp->runtime, since
this function is used in performance critical code path (ceval) */
return interp == _PyRuntime.interpreters.main;
}

static inline const PyConfig *
_Py_GetMainConfig(void)
Expand Down
9 changes: 0 additions & 9 deletions Python/pystate.c
Original file line number Diff line number Diff line change
Expand Up @@ -2125,15 +2125,6 @@ _PyThreadState_PopFrame(PyThreadState *tstate, InterpreterFrame * frame)
_Py_THREAD_LOCAL PyInterpreterState *_py_current_interpreter = NULL;
#endif

int
_Py_IsMainInterpreter(PyInterpreterState *interp)
{
/* Use directly _PyRuntime rather than tstate->interp->runtime, since
this function is used in performance critical code path (ceval) */
return interp == _PyRuntime.interpreters.main;
}


#ifdef __cplusplus
}
#endif