Skip to content

Commit 6c5a4b3

Browse files
authored
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.
1 parent 2f9cbaa commit 6c5a4b3

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fix "LC_ALL=C python3.7 -V": reset properly the command line parser when the
2+
encoding changes after reading the Python configuration.

Modules/main.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2015,6 +2015,7 @@ pymain_read_conf(_PyMain *pymain, _Py_CommandLineDetails *cmdline)
20152015
Py_IgnoreEnvironmentFlag = init_ignore_env;
20162016
_PyCoreConfig_Clear(&pymain->config);
20172017
pymain_clear_cmdline(pymain, cmdline);
2018+
memset(cmdline, 0, sizeof(*cmdline));
20182019
pymain_get_global_config(pymain, cmdline);
20192020

20202021
/* The encoding changed: read again the configuration

0 commit comments

Comments
 (0)