From da7933ecc30e37b119756cb02b89a6ad99db22e0 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Mon, 13 Apr 2020 03:04:28 +0200 Subject: bpo-40268: Add _PyInterpreterState_GetConfig() (GH-19492) Don't access PyInterpreterState.config member directly anymore, but use new functions: * _PyInterpreterState_GetConfig() * _PyInterpreterState_SetConfig() * _Py_GetConfig() --- Python/import.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'Python/import.c') diff --git a/Python/import.c b/Python/import.c index 2e434561f63..d79fa18e308 100644 --- a/Python/import.c +++ b/Python/import.c @@ -102,7 +102,7 @@ _PyImportZip_Init(PyThreadState *tstate) goto error; } - int verbose = tstate->interp->config.verbose; + int verbose = _PyInterpreterState_GetConfig(tstate->interp)->verbose; if (verbose) { PySys_WriteStderr("# installing zipimport hook\n"); } @@ -446,7 +446,7 @@ _PyImport_Cleanup(PyThreadState *tstate) /* XXX Perhaps these precautions are obsolete. Who knows? */ - int verbose = interp->config.verbose; + int verbose = _PyInterpreterState_GetConfig(interp)->verbose; if (verbose) { PySys_WriteStderr("# clear builtins._\n"); } @@ -811,7 +811,7 @@ import_find_extension(PyThreadState *tstate, PyObject *name, return NULL; } - int verbose = tstate->interp->config.verbose; + int verbose = _PyInterpreterState_GetConfig(tstate->interp)->verbose; if (verbose) { PySys_FormatStderr("import %U # previously loaded (%R)\n", name, filename); @@ -1523,7 +1523,7 @@ remove_importlib_frames(PyThreadState *tstate) which end with a call to "_call_with_frames_removed". */ _PyErr_Fetch(tstate, &exception, &value, &base_tb); - if (!exception || tstate->interp->config.verbose) { + if (!exception || _PyInterpreterState_GetConfig(tstate->interp)->verbose) { goto done; } @@ -1727,7 +1727,7 @@ import_find_and_load(PyThreadState *tstate, PyObject *abs_name) _Py_IDENTIFIER(_find_and_load); PyObject *mod = NULL; PyInterpreterState *interp = tstate->interp; - int import_time = interp->config.import_time; + int import_time = _PyInterpreterState_GetConfig(interp)->import_time; static int import_level; static _PyTime_t accumulated; @@ -2413,7 +2413,7 @@ PyInit__imp(void) goto failure; } - const wchar_t *mode = _PyInterpreterState_GET_UNSAFE()->config.check_hash_pycs_mode; + const wchar_t *mode = _Py_GetConfig()->check_hash_pycs_mode; PyObject *pyc_mode = PyUnicode_FromWideChar(mode, -1); if (pyc_mode == NULL) { goto failure; -- cgit v1.2.3