Skip to content

bpo-36763: Fix C locale coercion #13444

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 20, 2019
Merged

bpo-36763: Fix C locale coercion #13444

merged 1 commit into from
May 20, 2019

Conversation

vstinner
Copy link
Member

@vstinner vstinner commented May 20, 2019

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

https://bugs.python.org/issue36763

* 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.
@vstinner
Copy link
Member Author

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.

@vstinner vstinner merged commit 0f72147 into python:master May 20, 2019
@vstinner vstinner deleted the coerce_c_locale branch May 20, 2019 15:16
@ncoghlan
Copy link
Contributor

@vstinner Makes sense, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants