diff options
author | Victor Stinner <vstinner@redhat.com> | 2018-08-29 22:50:45 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-29 22:50:45 (GMT) |
commit | fbca90856d96273fd87c0b126f6e7966af7fbf7b (patch) | |
tree | 70be23311a03992573d5fb029acb03b208613440 /Modules/main.c | |
parent | de427556746aa41a8b5198924ce423021bc0c718 (diff) | |
download | cpython-fbca90856d96273fd87c0b126f6e7966af7fbf7b.zip cpython-fbca90856d96273fd87c0b126f6e7966af7fbf7b.tar.gz cpython-fbca90856d96273fd87c0b126f6e7966af7fbf7b.tar.bz2 |
bpo-34523: Use _PyCoreConfig instead of globals (GH-9005)
Use the core configuration of the interpreter, rather
than using global configuration variables. For example, replace
Py_QuietFlag with core_config->quiet.
Diffstat (limited to 'Modules/main.c')
-rw-r--r-- | Modules/main.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/Modules/main.c b/Modules/main.c index bf7290a..1ab555b 100644 --- a/Modules/main.c +++ b/Modules/main.c @@ -951,18 +951,18 @@ pymain_init_stdio(_PyMain *pymain, _PyCoreConfig *config) static void -pymain_header(_PyMain *pymain) +pymain_header(_PyMain *pymain, const _PyCoreConfig *config) { - if (Py_QuietFlag) { + if (config->quiet) { return; } - if (!Py_VerboseFlag && (RUN_CODE(pymain) || !pymain->stdin_is_interactive)) { + if (!config->verbose && (RUN_CODE(pymain) || !pymain->stdin_is_interactive)) { return; } fprintf(stderr, "Python %s on %s\n", Py_GetVersion(), Py_GetPlatform()); - if (!Py_NoSiteFlag) { + if (config->site_import) { fprintf(stderr, "%s\n", COPYRIGHT); } } @@ -1041,12 +1041,12 @@ wstrlist_as_pylist(int len, wchar_t **list) static void -pymain_import_readline(_PyMain *pymain) +pymain_import_readline(_PyMain *pymain, const _PyCoreConfig *config) { - if (Py_IsolatedFlag) { + if (config->isolated) { return; } - if (!Py_InspectFlag && RUN_CODE(pymain)) { + if (!config->inspect && RUN_CODE(pymain)) { return; } if (!isatty(fileno(stdin))) { @@ -1591,8 +1591,8 @@ pymain_run_python(_PyMain *pymain, PyInterpreterState *interp) PyCompilerFlags cf = {.cf_flags = 0}; - pymain_header(pymain); - pymain_import_readline(pymain); + pymain_header(pymain, config); + pymain_import_readline(pymain, config); if (pymain->command) { pymain->status = pymain_run_command(pymain->command, &cf); |