From caba55b3b735405b280273f7d99866a046c18281 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Fri, 3 Aug 2018 15:33:52 +0200 Subject: bpo-34301: Add _PyInterpreterState_Get() helper function (GH-8592) sys_setcheckinterval() now uses a local variable to parse arguments, before writing into interp->check_interval. --- Python/pythonrun.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'Python/pythonrun.c') diff --git a/Python/pythonrun.c b/Python/pythonrun.c index f6f06c7640..273eae25e2 100644 --- a/Python/pythonrun.c +++ b/Python/pythonrun.c @@ -92,7 +92,7 @@ PyRun_InteractiveLoopFlags(FILE *fp, const char *filename_str, PyCompilerFlags * PyCompilerFlags local_flags; int nomem_count = 0; #ifdef Py_REF_DEBUG - int show_ref_count = PyThreadState_GET()->interp->core_config.show_ref_count; + int show_ref_count = _PyInterpreterState_Get()->core_config.show_ref_count; #endif filename = PyUnicode_DecodeFSDefault(filename_str); @@ -336,17 +336,13 @@ maybe_pyc_file(FILE *fp, const char* filename, const char* ext, int closeit) static int set_main_loader(PyObject *d, const char *filename, const char *loader_name) { - PyInterpreterState *interp; - PyThreadState *tstate; PyObject *filename_obj, *bootstrap, *loader_type = NULL, *loader; int result = 0; filename_obj = PyUnicode_DecodeFSDefault(filename); if (filename_obj == NULL) return -1; - /* Get current thread state and interpreter pointer */ - tstate = PyThreadState_GET(); - interp = tstate->interp; + PyInterpreterState *interp = _PyInterpreterState_Get(); bootstrap = PyObject_GetAttrString(interp->importlib, "_bootstrap_external"); if (bootstrap != NULL) { -- cgit v1.2.1