static inline int
-_Py_IsMainInterpreter(PyThreadState* tstate)
+_Py_IsMainInterpreter(PyInterpreterState *interp)
{
/* Use directly _PyRuntime rather than tstate->interp->runtime, since
this function is used in performance critical code path (ceval) */
- return (tstate->interp == _PyRuntime.interpreters.main);
+ return (interp == _PyRuntime.interpreters.main);
}
tstate->interp->small_ints[i] = v;
}
- if (_Py_IsMainInterpreter(tstate)) {
+ if (_Py_IsMainInterpreter(tstate->interp)) {
/* initialize int_info */
if (Int_InfoType.tp_name == NULL) {
if (PyStructSequence_InitType2(&Int_InfoType, &int_info_desc) < 0) {
_PyType_Fini(PyThreadState *tstate)
{
_PyType_ClearCache(&tstate->interp->type_cache);
- if (_Py_IsMainInterpreter(tstate)) {
+ if (_Py_IsMainInterpreter(tstate->interp)) {
clear_slotdefs();
}
}
return _PyStatus_NO_MEMORY();
}
- if (_Py_IsMainInterpreter(tstate)) {
+ if (_Py_IsMainInterpreter(tstate->interp)) {
/* initialize the linebreak bloom filter */
bloom_linebreak = make_bloom_mask(
PyUnicode_2BYTE_KIND, linebreak,
_PyEval_InitGIL(PyThreadState *tstate)
{
#ifndef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS
- if (!_Py_IsMainInterpreter(tstate)) {
+ if (!_Py_IsMainInterpreter(tstate->interp)) {
/* Currently, the GIL is shared by all interpreters,
and only the main interpreter is responsible to create
and destroy it. */
_PyEval_FiniGIL(PyThreadState *tstate)
{
#ifndef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS
- if (!_Py_IsMainInterpreter(tstate)) {
+ if (!_Py_IsMainInterpreter(tstate->interp)) {
/* Currently, the GIL is shared by all interpreters,
and only the main interpreter is responsible to create
and destroy it. */
void
_PyContext_Fini(PyThreadState *tstate)
{
- if (_Py_IsMainInterpreter(tstate)) {
+ if (_Py_IsMainInterpreter(tstate->interp)) {
Py_CLEAR(_token_missing);
}
_PyContext_ClearFreeList(tstate);
return -1;
}
- if (_Py_IsMainInterpreter(tstate)) {
+ if (_Py_IsMainInterpreter(tstate->interp)) {
if (def->m_size == -1) {
if (def->m_base.m_copy) {
/* Somebody already imported the module,
}
}
- if (_Py_IsMainInterpreter(tstate)) {
+ if (_Py_IsMainInterpreter(tstate->interp)) {
PyStatus status = _PyConfig_WritePathConfig(config);
if (_PyStatus_EXCEPTION(status)) {
_PyErr_SetFromPyStatus(status);
pycore_init_types(PyThreadState *tstate)
{
PyStatus status;
- int is_main_interp = _Py_IsMainInterpreter(tstate);
+ int is_main_interp = _Py_IsMainInterpreter(tstate->interp);
status = _PyGC_Init(tstate);
if (_PyStatus_EXCEPTION(status)) {
assert(!_PyErr_Occurred(tstate));
PyStatus status;
- int is_main_interp = _Py_IsMainInterpreter(tstate);
+ int is_main_interp = _Py_IsMainInterpreter(tstate->interp);
PyInterpreterState *interp = tstate->interp;
const PyConfig *config = _PyInterpreterState_GetConfig(interp);
static void
finalize_interp_clear(PyThreadState *tstate)
{
- int is_main_interp = _Py_IsMainInterpreter(tstate);
+ int is_main_interp = _Py_IsMainInterpreter(tstate->interp);
/* Clear interpreter state and all thread states */
_PyInterpreterState_Clear(tstate);
static void
finalize_interp_delete(PyThreadState *tstate)
{
- if (_Py_IsMainInterpreter(tstate)) {
+ if (_Py_IsMainInterpreter(tstate->interp)) {
/* Cleanup auto-thread-state */
_PyGILState_Fini(tstate);
}
PyStatus
_PyGILState_Init(PyThreadState *tstate)
{
- if (!_Py_IsMainInterpreter(tstate)) {
+ if (!_Py_IsMainInterpreter(tstate->interp)) {
/* Currently, PyGILState is shared by all interpreters. The main
* interpreter is responsible to initialize it. */
return _PyStatus_OK();