summaryrefslogtreecommitdiffstats
path: root/Modules/main.c
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@redhat.com>2018-09-19 21:56:36 (GMT)
committerGitHub <noreply@github.com>2018-09-19 21:56:36 (GMT)
commit06e7608207daab9fb82d13ccf2d3664535442f11 (patch)
tree690da78834ebfbe2f3f0316972bfcbde97a67a8f /Modules/main.c
parent76531e2e82319a487d659bc469441bd4b8251608 (diff)
downloadcpython-06e7608207daab9fb82d13ccf2d3664535442f11.zip
cpython-06e7608207daab9fb82d13ccf2d3664535442f11.tar.gz
cpython-06e7608207daab9fb82d13ccf2d3664535442f11.tar.bz2
Revert "bpo-34589: Add -X coerce_c_locale command line option (GH-9378)" (GH-9430)
* Revert "bpo-34589: Add -X coerce_c_locale command line option (GH-9378)" This reverts commit dbdee0073cf0b88fe541980ace1f650900f455cc. * Revert "bpo-34589: C locale coercion off by default (GH-9073)" This reverts commit 7a0791b6992d420dc52536257f2f093851ed7215. * Revert "bpo-34589: Make _PyCoreConfig.coerce_c_locale private (GH-9371)" This reverts commit 188ebfa475a6f6aa2d0ea14ca8e1fbe7865b6d27.
Diffstat (limited to 'Modules/main.c')
-rw-r--r--Modules/main.c37
1 files changed, 9 insertions, 28 deletions
diff --git a/Modules/main.c b/Modules/main.c
index d4ae4a0..455178a 100644
--- a/Modules/main.c
+++ b/Modules/main.c
@@ -1342,9 +1342,9 @@ pymain_read_conf(_PyMain *pymain, _PyCoreConfig *config,
* See the documentation of the PYTHONCOERCECLOCALE setting for more
* details.
*/
- if (config->_coerce_c_locale && !locale_coerced) {
+ if (config->coerce_c_locale && !locale_coerced) {
locale_coerced = 1;
- _Py_CoerceLegacyLocale(config->_coerce_c_locale_warn);
+ _Py_CoerceLegacyLocale(config->coerce_c_locale_warn);
encoding_changed = 1;
}
@@ -1367,7 +1367,7 @@ pymain_read_conf(_PyMain *pymain, _PyCoreConfig *config,
/* Reset the configuration before reading again the configuration,
just keep UTF-8 Mode value. */
int new_utf8_mode = config->utf8_mode;
- int new_coerce_c_locale = config->_coerce_c_locale;
+ int new_coerce_c_locale = config->coerce_c_locale;
if (_PyCoreConfig_Copy(config, &save_config) < 0) {
pymain->err = _Py_INIT_NO_MEMORY();
goto done;
@@ -1375,7 +1375,7 @@ pymain_read_conf(_PyMain *pymain, _PyCoreConfig *config,
pymain_clear_cmdline(pymain, cmdline);
memset(cmdline, 0, sizeof(*cmdline));
config->utf8_mode = new_utf8_mode;
- config->_coerce_c_locale = new_coerce_c_locale;
+ config->coerce_c_locale = new_coerce_c_locale;
/* The encoding changed: read again the configuration
with the new encoding */
@@ -1700,8 +1700,7 @@ pymain_cmdline(_PyMain *pymain, _PyCoreConfig *config)
static int
-pymain_init(_PyMain *pymain, PyInterpreterState **interp_p,
- int use_c_locale_coercion)
+pymain_init(_PyMain *pymain, PyInterpreterState **interp_p)
{
/* 754 requires that FP exceptions run in "no stop" mode by default,
* and until C vendors implement C99's ways to control FP exceptions,
@@ -1714,11 +1713,6 @@ pymain_init(_PyMain *pymain, PyInterpreterState **interp_p,
_PyCoreConfig local_config = _PyCoreConfig_INIT;
_PyCoreConfig *config = &local_config;
- if (use_c_locale_coercion) {
- /* set to -1 to be able to enable the feature */
- config->_coerce_c_locale = -1;
- config->_coerce_c_locale_warn = -1;
- }
_PyCoreConfig_GetGlobalConfig(config);
@@ -1753,10 +1747,10 @@ pymain_init(_PyMain *pymain, PyInterpreterState **interp_p,
static int
-pymain_main(_PyMain *pymain, int use_c_locale_coercion)
+pymain_main(_PyMain *pymain)
{
PyInterpreterState *interp;
- int res = pymain_init(pymain, &interp, use_c_locale_coercion);
+ int res = pymain_init(pymain, &interp);
if (res != 1) {
if (pymain_run_python(pymain, interp) < 0) {
_Py_FatalInitError(pymain->err);
@@ -1783,22 +1777,10 @@ Py_Main(int argc, wchar_t **argv)
pymain.argc = argc;
pymain.wchar_argv = argv;
- return pymain_main(&pymain, 0);
+ return pymain_main(&pymain);
}
-#ifdef MS_WINDOWS
-int
-_Py_WindowsMain(int argc, wchar_t **argv)
-{
- _PyMain pymain = _PyMain_INIT;
- pymain.use_bytes_argv = 0;
- pymain.argc = argc;
- pymain.wchar_argv = argv;
-
- return pymain_main(&pymain, 1);
-}
-#else
int
_Py_UnixMain(int argc, char **argv)
{
@@ -1807,9 +1789,8 @@ _Py_UnixMain(int argc, char **argv)
pymain.argc = argc;
pymain.bytes_argv = argv;
- return pymain_main(&pymain, 1);
+ return pymain_main(&pymain);
}
-#endif
/* this is gonna seem *real weird*, but if you put some other code between