-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
gh-74940: Allow fallback to UTF-8 encoding on systems with no locales installed. #14925
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
Conversation
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
furkanonder
approved these changes
Apr 25, 2023
2726edf
to
c986412
Compare
Most changes to Python require a NEWS entry. Please add it using the blurb_it web app or the blurb command-line tool. |
This comment was marked as duplicate.
This comment was marked as duplicate.
1 similar comment
This comment was marked as duplicate.
This comment was marked as duplicate.
methane
approved these changes
Apr 26, 2023
itamaro
pushed a commit
to itamaro/cpython
that referenced
this pull request
Apr 26, 2023
…ocales installed (pythonGH-14925) This change removes the alias of the 'C' locale to 'en_US'. Because of this alias, it is currently impossible for an application to use setlocale() to specify a UTF-8 locale on a system that has no locales installed, but which supports the C.UTF-8 locale/encoding.
kkalinowski-reef
added a commit
to reef-technologies/b2-sdk-python
that referenced
this pull request
Dec 4, 2023
- On Linux, C.UTF-8 locale is now part of the standard. macOS and Windows use en_US.UTF-8 instead. - Up to 3.11, `locale.normalize` was converting `C.UTF-8` into `en_US.UTF-8`. If you normalized the locale string, it was impossible to set `C.UTF-8`. - In 3.12, `C.UTF-8` maps to itself. - python/cpython#14925 - https://peps.python.org/pep-0538/ - `C.UTF-8` doesn't seem to be used anywhere else in the codebase, except for this one test. - Other fix would be to inject a previous value to `locale.locale_alias` dictionary for certain platforms. However, this is part of the private implementation and could change without prior notice. - More changes to the locale are scheduled for 3.15.
This was referenced Dec 4, 2023
Closed
mjurbanski-reef
pushed a commit
to Backblaze/b2-sdk-python
that referenced
this pull request
Dec 5, 2023
* Fix the test that broke after 3.12 changes to locale.normalize - On Linux, C.UTF-8 locale is now part of the standard. macOS and Windows use en_US.UTF-8 instead. - Up to 3.11, `locale.normalize` was converting `C.UTF-8` into `en_US.UTF-8`. If you normalized the locale string, it was impossible to set `C.UTF-8`. - In 3.12, `C.UTF-8` maps to itself. - python/cpython#14925 - https://peps.python.org/pep-0538/ - `C.UTF-8` doesn't seem to be used anywhere else in the codebase, except for this one test. - Other fix would be to inject a previous value to `locale.locale_alias` dictionary for certain platforms. However, this is part of the private implementation and could change without prior notice. - More changes to the locale are scheduled for 3.15. * Format applied * Added changelog entry for towncrier * Prepended + to the changelog filename, as it's not closing any GitHub ticket * Removed TODO mentioning a broken locale in CI * Re-enabled 3.12 test matrix for both Windows and macOS
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This change removes the alias of the 'C' locale to 'en_US'. Because of this alias, it is currently impossible for an application to use setlocale() to specify a UTF-8 locale on a system that has no locales installed, but which supports the C.UTF-8 locale/encoding.
https://bugs.python.org/issue30755