summaryrefslogtreecommitdiffstats
path: root/Python/pythonrun.c
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@redhat.com>2018-08-03 13:33:52 (GMT)
committerGitHub <noreply@github.com>2018-08-03 13:33:52 (GMT)
commitcaba55b3b735405b280273f7d99866a046c18281 (patch)
tree3a98ac383b1fbab272158933255fb1a14107ebf6 /Python/pythonrun.c
parent2ebd3813af9172fe1f9b2f6004edf6f1e1e5d9f1 (diff)
downloadcpython-caba55b3b735405b280273f7d99866a046c18281.zip
cpython-caba55b3b735405b280273f7d99866a046c18281.tar.gz
cpython-caba55b3b735405b280273f7d99866a046c18281.tar.bz2
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.
Diffstat (limited to 'Python/pythonrun.c')
-rw-r--r--Python/pythonrun.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/Python/pythonrun.c b/Python/pythonrun.c
index f6f06c7..273eae2 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) {