diff options
author | Victor Stinner <vstinner@redhat.com> | 2019-05-14 15:34:56 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-14 15:34:56 (GMT) |
commit | c96be811fa7da8ddcea18cc7abcae94e0f5ff966 (patch) | |
tree | f3c6833ba92a084dc604498aecef6ef9103d6dfa /Modules | |
parent | 3c93153f7db5dd9b06f229e61978fd9199b3c097 (diff) | |
download | cpython-c96be811fa7da8ddcea18cc7abcae94e0f5ff966.zip cpython-c96be811fa7da8ddcea18cc7abcae94e0f5ff966.tar.gz cpython-c96be811fa7da8ddcea18cc7abcae94e0f5ff966.tar.bz2 |
bpo-36900: Replace global conf vars with config (GH-13299)
Replace global configuration variables with core_config read from the
current interpreter.
Cleanup dynload_hpux.c.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_io/_iomodule.c | 4 | ||||
-rw-r--r-- | Modules/main.c | 10 |
2 files changed, 8 insertions, 6 deletions
diff --git a/Modules/_io/_iomodule.c b/Modules/_io/_iomodule.c index d482142..590d6ce 100644 --- a/Modules/_io/_iomodule.c +++ b/Modules/_io/_iomodule.c @@ -9,6 +9,7 @@ #define PY_SSIZE_T_CLEAN #include "Python.h" +#include "pycore_pystate.h" /* _PyInterpreterState_GET_UNSAFE() */ #include "structmember.h" #include "_iomodule.h" @@ -376,7 +377,8 @@ _io_open_impl(PyObject *module, PyObject *file, const char *mode, { PyObject *RawIO_class = (PyObject *)&PyFileIO_Type; #ifdef MS_WINDOWS - if (!Py_LegacyWindowsStdioFlag && _PyIO_get_console_type(path_or_fd) != '\0') { + _PyCoreConfig *config = &_PyInterpreterState_GET_UNSAFE()->core_config; + if (!config->legacy_windows_stdio && _PyIO_get_console_type(path_or_fd) != '\0') { RawIO_class = (PyObject *)&PyWindowsConsoleIO_Type; encoding = "utf-8"; } diff --git a/Modules/main.c b/Modules/main.c index e117ef2..0f99e2a 100644 --- a/Modules/main.c +++ b/Modules/main.c @@ -403,8 +403,8 @@ static int pymain_run_stdin(_PyCoreConfig *config, PyCompilerFlags *cf) { if (stdin_is_interactive(config)) { - Py_InspectFlag = 0; /* do exit on SystemExit */ config->inspect = 0; + Py_InspectFlag = 0; /* do exit on SystemExit */ pymain_run_startup(config, cf); pymain_run_interactive_hook(); } @@ -425,17 +425,17 @@ pymain_repl(_PyCoreConfig *config, PyCompilerFlags *cf, int *exitcode) { /* Check this environment variable at the end, to give programs the opportunity to set it from Python. */ - if (!Py_InspectFlag && _Py_GetEnv(config->use_environment, "PYTHONINSPECT")) { - Py_InspectFlag = 1; + if (!config->inspect && _Py_GetEnv(config->use_environment, "PYTHONINSPECT")) { config->inspect = 1; + Py_InspectFlag = 1; } - if (!(Py_InspectFlag && stdin_is_interactive(config) && RUN_CODE(config))) { + if (!(config->inspect && stdin_is_interactive(config) && RUN_CODE(config))) { return; } - Py_InspectFlag = 0; config->inspect = 0; + Py_InspectFlag = 0; pymain_run_interactive_hook(); int res = PyRun_AnyFileFlags(stdin, "<stdin>", cf); |