Lines Matching defs:tstate

74 static PyStatus init_sys_streams(PyThreadState *tstate);
75 static void wait_for_thread_shutdown(PyThreadState *tstate);
176 init_importlib(PyThreadState *tstate, PyObject *sysmod)
178 assert(!_PyErr_Occurred(tstate));
180 PyInterpreterState *interp = tstate->interp;
200 PyObject *imp_mod = _PyImport_BootstrapImp(tstate);
218 assert(!_PyErr_Occurred(tstate));
224 init_importlib_external(PyThreadState *tstate)
227 value = PyObject_CallMethod(tstate->interp->importlib,
230 _PyErr_Print(tstate);
234 return _PyImportZip_Init(tstate);
464 interpreter_update_config(PyThreadState *tstate, int only_update_path_config)
466 const PyConfig *config = &tstate->interp->config;
469 PyStatus status = _PyConfig_Write(config, tstate->interp->runtime);
476 if (_Py_IsMainInterpreter(tstate->interp)) {
485 if (_PySys_UpdateConfig(tstate) < 0) {
495 PyThreadState *tstate = _PyThreadState_GET();
512 status = _PyConfig_Copy(&tstate->interp->config, &config);
518 res = interpreter_update_config(tstate, 0);
544 PyThreadState *tstate = _PyThreadState_GET();
545 if (!tstate) {
548 *tstate_p = tstate;
550 PyInterpreterState *interp = tstate->interp;
614 init_interp_create_gil(PyThreadState *tstate)
620 _PyEval_FiniGIL(tstate->interp);
623 status = _PyGILState_SetTstate(tstate);
629 status = _PyEval_InitGIL(tstate);
660 PyThreadState *tstate = PyThreadState_New(interp);
661 if (tstate == NULL) {
664 (void) PyThreadState_Swap(tstate);
666 status = init_interp_create_gil(tstate);
671 *tstate_p = tstate;
762 pycore_init_builtins(PyThreadState *tstate)
764 PyInterpreterState *interp = tstate->interp;
810 assert(!_PyErr_Occurred(tstate));
820 pycore_interp_init(PyThreadState *tstate)
822 PyInterpreterState *interp = tstate->interp;
859 status = _PySys_Create(tstate, &sysmod);
864 status = pycore_init_builtins(tstate);
872 if (init_importlib(tstate, sysmod) < 0) {
894 PyThreadState *tstate;
895 status = pycore_create_interpreter(runtime, config, &tstate);
899 *tstate_p = tstate;
901 status = pycore_interp_init(tstate);
1083 pyinit_main_reconfigure(PyThreadState *tstate)
1085 if (interpreter_update_config(tstate, 0) < 0) {
1093 init_interp_main(PyThreadState *tstate)
1097 assert(!_PyErr_Occurred(tstate));
1100 int is_main_interp = _Py_IsMainInterpreter(tstate->interp);
1101 PyInterpreterState *interp = tstate->interp;
1122 if (interpreter_update_config(tstate, 1) < 0) {
1126 status = init_importlib_external(tstate);
1139 status = _PyUnicode_InitEncodings(tstate);
1154 status = init_sys_streams(tstate);
1177 _PyErr_Print(tstate);
1201 assert(!_PyErr_Occurred(tstate));
1219 pyinit_main(PyThreadState *tstate)
1221 PyInterpreterState *interp = tstate->interp;
1227 return pyinit_main_reconfigure(tstate);
1230 PyStatus status = init_interp_main(tstate);
1253 PyThreadState *tstate = NULL;
1254 status = pyinit_core(runtime, config, &tstate);
1258 config = _PyInterpreterState_GetConfig(tstate->interp);
1261 status = pyinit_main(tstate);
1314 PyThreadState *tstate = _PyRuntimeState_GetThreadState(runtime);
1315 return pyinit_main(tstate);
1320 finalize_modules_delete_special(PyThreadState *tstate, int verbose)
1338 PyInterpreterState *interp = tstate->interp;
1364 if (_PyErr_Occurred(tstate)) {
1463 finalize_restore_builtins(PyThreadState *tstate)
1465 PyInterpreterState *interp = tstate->interp;
1472 _PyErr_Clear(tstate);
1524 finalize_modules(PyThreadState *tstate)
1526 PyInterpreterState *interp = tstate->interp;
1541 finalize_modules_delete_special(tstate, verbose);
1557 finalize_restore_builtins(tstate);
1560 _PyGC_CollectNoFail(tstate);
1600 _PyGC_CollectNoFail(tstate);
1626 PyThreadState *tstate = _PyThreadState_GET();
1627 PyObject *fout = _PySys_GetAttr(tstate, &_Py_ID(stdout));
1628 PyObject *ferr = _PySys_GetAttr(tstate, &_Py_ID(stderr));
1701 finalize_interp_clear(PyThreadState *tstate)
1703 int is_main_interp = _Py_IsMainInterpreter(tstate->interp);
1705 _PyExc_ClearExceptionGroupType(tstate->interp);
1708 _PyInterpreterState_Clear(tstate);
1718 _PySys_ClearAuditHooks(tstate);
1728 finalize_interp_types(tstate->interp);
1761 PyThreadState *tstate = _PyRuntimeState_GetThreadState(runtime);
1764 wait_for_thread_shutdown(tstate);
1767 _Py_FinishPendingCalls(tstate);
1779 _PyAtExit_Call(tstate->interp);
1784 int show_ref_count = tstate->interp->config.show_ref_count;
1787 int dump_refs = tstate->interp->config.dump_refs;
1788 wchar_t *dump_refs_file = tstate->interp->config.dump_refs_file;
1791 int malloc_stats = tstate->interp->config.malloc_stats;
1796 _PyRuntimeState_SetFinalizing(runtime, tstate);
1808 _PyThreadState_DeleteExcept(runtime, tstate);
1833 finalize_modules(tstate);
1899 finalize_interp_clear(tstate);
1900 finalize_interp_delete(tstate->interp);
1980 PyThreadState *tstate = PyThreadState_New(interp);
1981 if (tstate == NULL) {
1987 PyThreadState *save_tstate = PyThreadState_Swap(tstate);
2008 status = init_interp_create_gil(tstate);
2013 status = pycore_interp_init(tstate);
2018 status = init_interp_main(tstate);
2023 *tstate_p = tstate;
2032 PyThreadState_Clear(tstate);
2033 PyThreadState_Delete(tstate);
2042 PyThreadState *tstate = NULL;
2043 PyStatus status = new_interpreter(&tstate, isolated_subinterpreter);
2047 return tstate;
2070 Py_EndInterpreter(PyThreadState *tstate)
2072 PyInterpreterState *interp = tstate->interp;
2074 if (tstate != _PyThreadState_GET()) {
2077 if (tstate->cframe->current_frame != NULL) {
2083 wait_for_thread_shutdown(tstate);
2085 _PyAtExit_Call(tstate->interp);
2087 if (tstate != interp->threads.head || tstate->next != NULL) {
2091 finalize_modules(tstate);
2093 finalize_interp_clear(tstate);
2094 finalize_interp_delete(tstate->interp);
2388 init_sys_streams(PyThreadState *tstate)
2395 const PyConfig *config = _PyInterpreterState_GetConfig(tstate->interp);
2460 _PyErr_Clear(tstate); /* Not a fatal error if codec isn't available */
2487 PyThreadState *tstate)
2492 _Py_DumpTracebackThreads(fd, interp, tstate);
2504 _Py_FatalError_PrintExc(PyThreadState *tstate)
2510 _PyErr_Fetch(tstate, &exception, &v, &tb);
2516 ferr = _PySys_GetAttr(tstate, &_Py_ID(stderr));
2523 _PyErr_NormalizeException(tstate, &exception, &v, &tb);
2543 _PyErr_Clear(tstate);
2596 PUTS(fd, "finalizing (tstate=0x");
2765 tss_tstate != tstate if the current Python thread does not hold the GIL.
2767 PyThreadState *tstate = _PyRuntimeState_GetThreadState(runtime);
2770 if (tstate != NULL) {
2771 interp = tstate->interp;
2776 int has_tstate_and_gil = (tss_tstate != NULL && tss_tstate == tstate);
2891 wait_for_thread_shutdown(PyThreadState *tstate)
2896 if (_PyErr_Occurred(tstate)) {