bpo-18378: Recognize "UTF-8" as a valid name in locale._parse_localename#14736
bpo-18378: Recognize "UTF-8" as a valid name in locale._parse_localename#14736ned-deily merged 2 commits intopython:masterfrom
Conversation
|
The pull-request enables recognition of "UTF-8" as a valid value on all platforms. I've primarily done this because the value of LC_CTYPE will usually leak into the target system when you use SSH to log on those systems. |
|
Victor, I've asked for your review because you're involved with the code that sets LC_CTYPE during interpreter startup. |
|
locale.getpreferredencoding() is based on nl_langinfo(CODESET) which is reliable. I never understood the purpose of the locale.getdefaultlocale() function, especially locale._parse_localename(). What is the use case for locale.getdefaultlocale()? |
I don't know what the use case is, but this is a public API that's currently broken on macOS. I've run into this issue in the past when using software that uses this API, but to be honest I don't recall which software that was. The BPO issue mentions (older versions of?) docutils that use this API. |
|
Thanks @ronaldoussoren for the PR, and @ned-deily for merging it 🌮🎉.. I'm working now to backport this PR to: 3.7, 3.8. |
|
GH-15569 is a backport of this pull request to the 3.8 branch. |
…ame (pythonGH-14736) (cherry picked from commit b0caf32) Co-authored-by: Ronald Oussoren <[email protected]>
|
GH-15570 is a backport of this pull request to the 3.7 branch. |
…ame (pythonGH-14736) (cherry picked from commit b0caf32) Co-authored-by: Ronald Oussoren <[email protected]>
…ame (GH-14736) (cherry picked from commit b0caf32) Co-authored-by: Ronald Oussoren <[email protected]>
…ame (GH-14736) (cherry picked from commit b0caf32) Co-authored-by: Ronald Oussoren <[email protected]>
"UTF-8" is a valid value for LC_CTYPE on macOS, and the variable is set to that value during interpreter startup by the UTF-8 coercion code in pylifecycle.c.
https://bugs.python.org/issue18378