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.
This commit is contained in:
Victor Stinner 2018-06-16 00:06:28 +02:00 committed by GitHub
parent 2f9cbaa8b2
commit 6c5a4b3156
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 0 deletions

View file

@ -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.

View 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