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.
This commit is contained in:
Victor Stinner 2018-08-03 15:33:52 +02:00 committed by GitHub
parent 2ebd3813af
commit caba55b3b7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
22 changed files with 107 additions and 93 deletions

View file

@ -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) {