diff options
author | Victor Stinner <vstinner@python.org> | 2020-04-13 01:04:28 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-13 01:04:28 (GMT) |
commit | da7933ecc30e37b119756cb02b89a6ad99db22e0 (patch) | |
tree | e6c7227f2ded7b7354fb027342fa977f70808d10 /Python/sysmodule.c | |
parent | 14d5331eb5e6c38be12bad421bd59ad0fac9e448 (diff) | |
download | cpython-da7933ecc30e37b119756cb02b89a6ad99db22e0.zip cpython-da7933ecc30e37b119756cb02b89a6ad99db22e0.tar.gz cpython-da7933ecc30e37b119756cb02b89a6ad99db22e0.tar.bz2 |
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()
Diffstat (limited to 'Python/sysmodule.c')
-rw-r--r-- | Python/sysmodule.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/Python/sysmodule.c b/Python/sysmodule.c index 994e358..fd0a9c0 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -23,7 +23,6 @@ Data members: #include "pycore_pyerrors.h" #include "pycore_pylifecycle.h" #include "pycore_pymem.h" -#include "pycore_pystate.h" #include "pycore_tupleobject.h" #include "pythread.h" #include "pydtrace.h" @@ -337,7 +336,7 @@ _PySys_ClearAuditHooks(PyThreadState *ts) return; } - const PyConfig *config = &ts->interp->config; + const PyConfig *config = _PyInterpreterState_GetConfig(ts->interp); if (config->verbose) { PySys_WriteStderr("# clear sys.audit hooks\n"); } @@ -846,8 +845,8 @@ static PyObject * sys_getfilesystemencoding_impl(PyObject *module) /*[clinic end generated code: output=1dc4bdbe9be44aa7 input=8475f8649b8c7d8c]*/ { - PyThreadState *tstate = _PyThreadState_GET(); - const PyConfig *config = &tstate->interp->config; + PyInterpreterState *interp = _PyInterpreterState_GET_UNSAFE(); + const PyConfig *config = _PyInterpreterState_GetConfig(interp); return PyUnicode_FromWideChar(config->filesystem_encoding, -1); } @@ -861,8 +860,8 @@ static PyObject * sys_getfilesystemencodeerrors_impl(PyObject *module) /*[clinic end generated code: output=ba77b36bbf7c96f5 input=22a1e8365566f1e5]*/ { - PyThreadState *tstate = _PyThreadState_GET(); - const PyConfig *config = &tstate->interp->config; + PyInterpreterState *interp = _PyInterpreterState_GET_UNSAFE(); + const PyConfig *config = _PyInterpreterState_GetConfig(interp); return PyUnicode_FromWideChar(config->filesystem_errors, -1); } @@ -2455,7 +2454,7 @@ make_flags(PyThreadState *tstate) { PyInterpreterState *interp = tstate->interp; const PyPreConfig *preconfig = &interp->runtime->preconfig; - const PyConfig *config = &interp->config; + const PyConfig *config = _PyInterpreterState_GetConfig(interp); PyObject *seq = PyStructSequence_New(&FlagsType); if (seq == NULL) { @@ -2889,7 +2888,7 @@ int _PySys_InitMain(PyThreadState *tstate) { PyObject *sysdict = tstate->interp->sysdict; - const PyConfig *config = &tstate->interp->config; + const PyConfig *config = _PyInterpreterState_GetConfig(tstate->interp); int res; #define COPY_LIST(KEY, VALUE) \ |