Lines Matching refs:tstate
59 static PyStatus init_sys_streams(PyThreadState *tstate);
60 static void call_py_exitfuncs(PyThreadState *tstate);
61 static void wait_for_thread_shutdown(PyThreadState *tstate);
142 init_importlib(PyThreadState *tstate, PyObject *sysmod) in init_importlib() argument
147 PyInterpreterState *interp = tstate->interp; in init_importlib()
184 _PyErr_Print(tstate); in init_importlib()
194 init_importlib_external(PyThreadState *tstate) in init_importlib_external() argument
197 value = PyObject_CallMethod(tstate->interp->importlib, in init_importlib_external()
200 _PyErr_Print(tstate); in init_importlib_external()
204 return _PyImportZip_Init(tstate); in init_importlib_external()
451 PyThreadState *tstate = _PyThreadState_GET(); in pyinit_core_reconfigure() local
452 if (!tstate) { in pyinit_core_reconfigure()
455 *tstate_p = tstate; in pyinit_core_reconfigure()
457 PyInterpreterState *interp = tstate->interp; in pyinit_core_reconfigure()
521 init_interp_create_gil(PyThreadState *tstate) in init_interp_create_gil() argument
527 _PyEval_FiniGIL(tstate); in init_interp_create_gil()
530 status = _PyGILState_Init(tstate); in init_interp_create_gil()
536 status = _PyEval_InitGIL(tstate); in init_interp_create_gil()
560 PyThreadState *tstate = PyThreadState_New(interp); in pycore_create_interpreter() local
561 if (tstate == NULL) { in pycore_create_interpreter()
564 (void) PyThreadState_Swap(tstate); in pycore_create_interpreter()
566 status = init_interp_create_gil(tstate); in pycore_create_interpreter()
571 *tstate_p = tstate; in pycore_create_interpreter()
577 pycore_init_types(PyThreadState *tstate) in pycore_init_types() argument
580 int is_main_interp = _Py_IsMainInterpreter(tstate); in pycore_init_types()
582 status = _PyGC_Init(tstate); in pycore_init_types()
595 if (!_PyLong_Init(tstate)) { in pycore_init_types()
637 pycore_init_builtins(PyThreadState *tstate) in pycore_init_builtins() argument
639 assert(!_PyErr_Occurred(tstate)); in pycore_init_builtins()
641 PyObject *bimod = _PyBuiltin_Init(tstate); in pycore_init_builtins()
646 PyInterpreterState *interp = tstate->interp; in pycore_init_builtins()
669 assert(!_PyErr_Occurred(tstate)); in pycore_init_builtins()
680 pycore_init_import_warnings(PyThreadState *tstate, PyObject *sysmod) in pycore_init_import_warnings() argument
682 assert(!_PyErr_Occurred(tstate)); in pycore_init_import_warnings()
684 PyStatus status = _PyImportHooks_Init(tstate); in pycore_init_import_warnings()
689 const PyConfig *config = _PyInterpreterState_GetConfig(tstate->interp); in pycore_init_import_warnings()
690 if (_Py_IsMainInterpreter(tstate)) { in pycore_init_import_warnings()
692 status = _PyWarnings_InitState(tstate); in pycore_init_import_warnings()
707 status = init_importlib(tstate, sysmod); in pycore_init_import_warnings()
713 assert(!_PyErr_Occurred(tstate)); in pycore_init_import_warnings()
720 pycore_interp_init(PyThreadState *tstate) in pycore_interp_init() argument
725 status = pycore_init_types(tstate); in pycore_interp_init()
730 status = _PySys_Create(tstate, &sysmod); in pycore_interp_init()
735 status = pycore_init_builtins(tstate); in pycore_interp_init()
740 status = pycore_init_import_warnings(tstate, sysmod); in pycore_interp_init()
759 PyThreadState *tstate; in pyinit_config() local
760 status = pycore_create_interpreter(runtime, config, &tstate); in pyinit_config()
764 *tstate_p = tstate; in pyinit_config()
766 status = pycore_interp_init(tstate); in pyinit_config()
946 _Py_ReconfigureMainInterpreter(PyThreadState *tstate) in _Py_ReconfigureMainInterpreter() argument
948 const PyConfig *config = _PyInterpreterState_GetConfig(tstate->interp); in _Py_ReconfigureMainInterpreter()
955 int res = PyDict_SetItemString(tstate->interp->sysdict, "argv", argv); in _Py_ReconfigureMainInterpreter()
965 init_interp_main(PyThreadState *tstate) in init_interp_main() argument
967 assert(!_PyErr_Occurred(tstate)); in init_interp_main()
970 int is_main_interp = _Py_IsMainInterpreter(tstate); in init_interp_main()
971 PyInterpreterState *interp = tstate->interp; in init_interp_main()
992 if (_PySys_InitMain(tstate) < 0) { in init_interp_main()
996 status = init_importlib_external(tstate); in init_interp_main()
1009 status = _PyUnicode_InitEncodings(tstate); in init_interp_main()
1024 status = init_sys_streams(tstate); in init_interp_main()
1047 _PyErr_Print(tstate); in init_interp_main()
1068 assert(!_PyErr_Occurred(tstate)); in init_interp_main()
1086 pyinit_main(PyThreadState *tstate) in pyinit_main() argument
1088 PyInterpreterState *interp = tstate->interp; in pyinit_main()
1094 return _Py_ReconfigureMainInterpreter(tstate); in pyinit_main()
1097 PyStatus status = init_interp_main(tstate); in pyinit_main()
1113 PyThreadState *tstate = _PyRuntimeState_GetThreadState(runtime); in _Py_InitializeMain() local
1114 return pyinit_main(tstate); in _Py_InitializeMain()
1133 PyThreadState *tstate = NULL; in Py_InitializeFromConfig() local
1134 status = pyinit_core(runtime, config, &tstate); in Py_InitializeFromConfig()
1138 config = _PyInterpreterState_GetConfig(tstate->interp); in Py_InitializeFromConfig()
1141 status = pyinit_main(tstate); in Py_InitializeFromConfig()
1250 finalize_interp_types(PyThreadState *tstate, int is_main_interp) in finalize_interp_types() argument
1262 _PyLong_Fini(tstate); in finalize_interp_types()
1270 _PyWarnings_Fini(tstate->interp); in finalize_interp_types()
1280 _PyUnicode_Fini(tstate); in finalize_interp_types()
1289 finalize_interp_clear(PyThreadState *tstate) in finalize_interp_clear() argument
1291 int is_main_interp = _Py_IsMainInterpreter(tstate); in finalize_interp_clear()
1294 PyInterpreterState_Clear(tstate->interp); in finalize_interp_clear()
1305 _PySys_ClearAuditHooks(tstate); in finalize_interp_clear()
1308 finalize_interp_types(tstate, is_main_interp); in finalize_interp_clear()
1322 _PyGC_Fini(tstate); in finalize_interp_clear()
1327 finalize_interp_delete(PyThreadState *tstate) in finalize_interp_delete() argument
1329 if (_Py_IsMainInterpreter(tstate)) { in finalize_interp_delete()
1331 _PyGILState_Fini(tstate); in finalize_interp_delete()
1340 PyInterpreterState_Delete(tstate->interp); in finalize_interp_delete()
1355 PyThreadState *tstate = _PyRuntimeState_GetThreadState(runtime); in Py_FinalizeEx() local
1358 wait_for_thread_shutdown(tstate); in Py_FinalizeEx()
1361 _Py_FinishPendingCalls(tstate); in Py_FinalizeEx()
1373 call_py_exitfuncs(tstate); in Py_FinalizeEx()
1378 int show_ref_count = tstate->interp->config.show_ref_count; in Py_FinalizeEx()
1381 int dump_refs = tstate->interp->config.dump_refs; in Py_FinalizeEx()
1384 int malloc_stats = tstate->interp->config.malloc_stats; in Py_FinalizeEx()
1389 _PyRuntimeState_SetFinalizing(runtime, tstate); in Py_FinalizeEx()
1401 _PyThreadState_DeleteExcept(runtime, tstate); in Py_FinalizeEx()
1426 _PyImport_Cleanup(tstate); in Py_FinalizeEx()
1488 finalize_interp_clear(tstate); in Py_FinalizeEx()
1489 finalize_interp_delete(tstate); in Py_FinalizeEx()
1557 PyThreadState *tstate = PyThreadState_New(interp); in new_interpreter() local
1558 if (tstate == NULL) { in new_interpreter()
1564 PyThreadState *save_tstate = PyThreadState_Swap(tstate); in new_interpreter()
1584 status = init_interp_create_gil(tstate); in new_interpreter()
1589 status = pycore_interp_init(tstate); in new_interpreter()
1594 status = init_interp_main(tstate); in new_interpreter()
1599 *tstate_p = tstate; in new_interpreter()
1607 PyThreadState_Clear(tstate); in new_interpreter()
1608 PyThreadState_Delete(tstate); in new_interpreter()
1618 PyThreadState *tstate = NULL; in _Py_NewInterpreter() local
1619 PyStatus status = new_interpreter(&tstate, isolated_subinterpreter); in _Py_NewInterpreter()
1623 return tstate; in _Py_NewInterpreter()
1646 Py_EndInterpreter(PyThreadState *tstate) in Py_EndInterpreter() argument
1648 PyInterpreterState *interp = tstate->interp; in Py_EndInterpreter()
1650 if (tstate != _PyThreadState_GET()) { in Py_EndInterpreter()
1653 if (tstate->frame != NULL) { in Py_EndInterpreter()
1659 wait_for_thread_shutdown(tstate); in Py_EndInterpreter()
1661 call_py_exitfuncs(tstate); in Py_EndInterpreter()
1663 if (tstate != interp->tstate_head || tstate->next != NULL) { in Py_EndInterpreter()
1667 _PyImport_Cleanup(tstate); in Py_EndInterpreter()
1668 finalize_interp_clear(tstate); in Py_EndInterpreter()
1669 finalize_interp_delete(tstate); in Py_EndInterpreter()
1950 init_sys_streams(PyThreadState *tstate) in init_sys_streams() argument
1958 const PyConfig *config = _PyInterpreterState_GetConfig(tstate->interp); in init_sys_streams()
2035 _PyErr_Clear(tstate); /* Not a fatal error if codec isn't available */ in init_sys_streams()
2062 PyThreadState *tstate) in _Py_FatalError_DumpTracebacks() argument
2068 _Py_DumpTracebackThreads(fd, interp, tstate); in _Py_FatalError_DumpTracebacks()
2080 _Py_FatalError_PrintExc(PyThreadState *tstate) in _Py_FatalError_PrintExc() argument
2086 _PyErr_Fetch(tstate, &exception, &v, &tb); in _Py_FatalError_PrintExc()
2099 _PyErr_NormalizeException(tstate, &exception, &v, &tb); in _Py_FatalError_PrintExc()
2119 _PyErr_Clear(tstate); in _Py_FatalError_PrintExc()
2242 PyThreadState *tstate = _PyRuntimeState_GetThreadState(runtime); in fatal_error() local
2244 if (tstate != NULL) { in fatal_error()
2245 interp = tstate->interp; in fatal_error()
2257 int has_tstate_and_gil = (tss_tstate != NULL && tss_tstate == tstate); in fatal_error()
2368 call_py_exitfuncs(PyThreadState *tstate) in call_py_exitfuncs() argument
2370 PyInterpreterState *interp = tstate->interp; in call_py_exitfuncs()
2375 _PyErr_Clear(tstate); in call_py_exitfuncs()
2383 wait_for_thread_shutdown(PyThreadState *tstate) in wait_for_thread_shutdown() argument
2389 if (_PyErr_Occurred(tstate)) { in wait_for_thread_shutdown()