bpo-36763: Fix C locale coercion by vstinner · Pull Request #13444 · python/cpython
Conversation
- Fix _Py_LegacyLocaleDetected(): don't attempt to coerce the
C locale if LC_ALL environment variable is set. Add 'warn'
parameter: emit_stderr_warning_for_legacy_locale() must check for
the LC_ALL env var. - _PyPreConfig_Write() sets coerce_c_locale to 0 if
_Py_CoerceLegacyLocale() fails.
Altogether, _PyRuntime.preconfig.coerce_c_locale can now be used to
check if the C locale has been coerced.
* Fix _Py_LegacyLocaleDetected(): don't attempt to coerce the C locale if LC_ALL environment variable is set. Add 'warn' parameter: emit_stderr_warning_for_legacy_locale() must check for the LC_ALL env var. * _PyPreConfig_Write() sets coerce_c_locale to 0 if _Py_CoerceLegacyLocale() fails. Altogether, _PyRuntime.preconfig.coerce_c_locale can now be used to check if the C locale has been coerced.
cc @ncoghlan: this PR doesn't change the Python behavior, it only changes _PyRuntime.preconfig.coerce_c_locale when LC_ALL env var is set, or if coercion the C locale fails. _PyRuntime.preconfig.coerce_c_locale is set to 0 in this case, instead of 2.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters