-
-
Notifications
You must be signed in to change notification settings - Fork 30k
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
Deprecate getlocale() and normalize() functions #87723
Comments
I propose to deprecate getdefaultlocale(), getlocale() and normalize() functions since they have multiple issues, and remove them in Python 3.12. The normalize() function uses the locale.locale_alias dictionary which was copied from the X11 locale database in 2000. It's hard to keep this dictionary up to date and to support all locales of all platforms supported by Python. There are multiple issues on macOS for example. getdefaultlocale() and getlocale() use heuristics to get an encoding from the locale name. These heuristics are not reliable. getdefaultlocale() only rely on environment variables. When setlocale() is called, environment variables are not updated, and so the encoding returned by getdefaultlocale() is not the effective LC_CTYPE locale encoding. Example: getlocale() open issues:
getdefaultlocale() open issue:
Replacements:
|
+1 on getdefaultlocale() as mentioned in https://bugs.python.org/issue43552 However, -1 on getlocale() and normalize(). Those two are needed to access and successfully set the locale on The issues open for these should be addressed and fixed. |
Deprecating these functions is complex. I prefer to start with the least controversial part: bpo-46659. |
locale.getdefaultlocale() is now deprecated in Python 3.11. |
Sadly, I don't have the bandwidth to work on this issue, so I just close it. At least, locale.getdefaultlocale() is now deprecated in Python 3.11. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: