[Python-checkins] bpo-33824, bpo-32030: Fix pymain_read_conf() (GH-7712)

Miss Islington (bot) webhook-mailer at python.org
Fri Jun 15 18:26:32 EDT 2018


https://github.com/python/cpython/commit/046da1669598d6112d0a6fb056081f3eb5a4d4e7
commit: 046da1669598d6112d0a6fb056081f3eb5a4d4e7
branch: 3.7
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: GitHub <noreply at github.com>
date: 2018-06-15T15:26:29-07:00
summary:

bpo-33824, bpo-32030: Fix pymain_read_conf() (GH-7712)


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.
(cherry picked from commit 6c5a4b315664f21bffc36ff6987fb4c4d1590897)

Co-authored-by: Victor Stinner <vstinner at redhat.com>

files:
A Misc/NEWS.d/next/Core and Builtins/2018-06-15-19-39-06.bpo-33824.DfWHT3.rst
M 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
index 000000000000..fda2ea7423dd
--- /dev/null
+++ b/Misc/NEWS.d/next/Core and Builtins/2018-06-15-19-39-06.bpo-33824.DfWHT3.rst	
@@ -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.
diff --git a/Modules/main.c b/Modules/main.c
index 286ad418fe13..3809fa4abef5 100644
--- a/Modules/main.c
+++ b/Modules/main.c
@@ -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



More information about the Python-checkins mailing list