◐ Shell
clean mode source ↗

bpo-34485: Fix _Py_InitializeCore() for C locale coercion by vstinner · Pull Request #8979 · python/cpython

Expand Up @@ -1344,7 +1344,7 @@ pymain_read_conf(_PyMain *pymain, _PyCoreConfig *config, * See the documentation of the PYTHONCOERCECLOCALE setting for more * details. */ if (config->coerce_c_locale == 1 && !locale_coerced) { if (config->coerce_c_locale && !locale_coerced) { locale_coerced = 1; _Py_CoerceLegacyLocale(config); encoding_changed = 1; Expand All @@ -1369,13 +1369,15 @@ 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; if (_PyCoreConfig_Copy(config, &save_config) < 0) { pymain->err = _Py_INIT_NO_MEMORY(); goto done; } pymain_clear_cmdline(pymain, cmdline); memset(cmdline, 0, sizeof(*cmdline)); config->utf8_mode = new_utf8_mode; config->coerce_c_locale = new_coerce_c_locale;
/* The encoding changed: read again the configuration with the new encoding */ Expand Down