]> granicus.if.org Git - python/commitdiff
bpo-33824, bpo-32030: Fix pymain_read_conf() (GH-7712)
authorVictor Stinner <vstinner@redhat.com>
Fri, 15 Jun 2018 22:06:28 +0000 (00:06 +0200)
committerGitHub <noreply@github.com>
Fri, 15 Jun 2018 22:06:28 +0000 (00:06 +0200)
Fix "LC_ALL=C python3.7 -V": reset properly the command line parser
when the encoding changes after reading the Python configuration.

Fix pymain_read_conf(): use memset(0) to reset properly cmdline.

Misc/NEWS.d/next/Core and Builtins/2018-06-15-19-39-06.bpo-33824.DfWHT3.rst [new file with mode: 0644]
Modules/main.c

diff --git a/Misc/NEWS.d/next/Core and Builtins/2018-06-15-19-39-06.bpo-33824.DfWHT3.rst b/Misc/NEWS.d/next/Core and Builtins/2018-06-15-19-39-06.bpo-33824.DfWHT3.rst
new file mode 100644 (file)
index 0000000..fda2ea7
--- /dev/null
@@ -0,0 +1,2 @@
+Fix "LC_ALL=C python3.7 -V": reset properly the command line parser when the
+encoding changes after reading the Python configuration.
index 286ad418fe13a5b47d64a37d979be773342d5f99..3809fa4abef5743bc598cb010448ac712f375310 100644 (file)
@@ -2015,6 +2015,7 @@ pymain_read_conf(_PyMain *pymain, _Py_CommandLineDetails *cmdline)
         Py_IgnoreEnvironmentFlag = init_ignore_env;
         _PyCoreConfig_Clear(&pymain->config);
         pymain_clear_cmdline(pymain, cmdline);
+        memset(cmdline, 0, sizeof(*cmdline));
         pymain_get_global_config(pymain, cmdline);
 
         /* The encoding changed: read again the configuration