Skip to content
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

bpo-18378: Recognize "UTF-8" as a valid name in locale._parse_localename #14736

Merged
merged 2 commits into from
Aug 29, 2019

Conversation

ronaldoussoren
Copy link
Contributor

@ronaldoussoren ronaldoussoren commented Jul 13, 2019

"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

@ronaldoussoren
Copy link
Contributor Author

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.

@ronaldoussoren
Copy link
Contributor Author

Victor, I've asked for your review because you're involved with the code that sets LC_CTYPE during interpreter startup.

@vstinner
Copy link
Member

vstinner commented Aug 1, 2019

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()?

@ronaldoussoren
Copy link
Contributor Author

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.

Copy link
Member

@ned-deily ned-deily left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ned-deily ned-deily merged commit b0caf32 into python:master Aug 29, 2019
@miss-islington
Copy link
Contributor

Thanks @ronaldoussoren for the PR, and @ned-deily for merging it 🌮🎉.. I'm working now to backport this PR to: 3.7, 3.8.
🐍🍒⛏🤖

@bedevere-bot
Copy link

GH-15569 is a backport of this pull request to the 3.8 branch.

@bedevere-bot bedevere-bot removed the needs backport to 3.8 only security fixes label Aug 29, 2019
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Aug 29, 2019
…ame (pythonGH-14736)

(cherry picked from commit b0caf32)

Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com>
@bedevere-bot
Copy link

GH-15570 is a backport of this pull request to the 3.7 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Aug 29, 2019
…ame (pythonGH-14736)

(cherry picked from commit b0caf32)

Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com>
miss-islington added a commit that referenced this pull request Aug 29, 2019
…ame (GH-14736)

(cherry picked from commit b0caf32)

Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com>
miss-islington added a commit that referenced this pull request Aug 29, 2019
…ame (GH-14736)

(cherry picked from commit b0caf32)

Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants