-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
gh-133740: Fix locale.nl_langinfo(ALT_DIGITS) #134468
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
Conversation
Set the LC_CTYPE locale to the LC_TIME locale even if nl_langinfo(ALT_DIGITS) result is ASCII. The result is a list separated by NUL characters and the code only checks the first list item which can be ASCII whereas following items are non-ASCII. Fix test__locale for the uk_UA locale on RHEL 7.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. 👍 👏
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ALT_DIGITS may be not defined.
Modules/_localemodule.c
Outdated
@@ -692,7 +692,8 @@ _locale_nl_langinfo_impl(PyObject *module, int item) | |||
result = result != NULL ? result : ""; | |||
char *oldloc = NULL; | |||
if (langinfo_constants[i].category != LC_CTYPE | |||
&& !is_all_ascii(result) | |||
// gh-133740: Always change the locale for ALT_DIGITS | |||
&& (item == ALT_DIGITS || !is_all_ascii(result)) |
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
When you're done making the requested changes, leave the comment: |
@serhiy-storchaka: I updated the PR, please review again. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. 👍
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Thanks @vstinner for the PR 🌮🎉.. I'm working now to backport this PR to: 3.14. |
Set the LC_CTYPE locale to the LC_TIME locale even if nl_langinfo(ALT_DIGITS) result is ASCII. The result is a list separated by NUL characters and the code only checks the first list item which can be ASCII whereas following items are non-ASCII. Fix test__locale for the uk_UA locale on RHEL 7. (cherry picked from commit 899c7dc) Co-authored-by: Victor Stinner <vstinner@python.org> Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
GH-134512 is a backport of this pull request to the 3.14 branch. |
…4512) gh-133740: Fix locale.nl_langinfo(ALT_DIGITS) (GH-134468) Set the LC_CTYPE locale to the LC_TIME locale even if nl_langinfo(ALT_DIGITS) result is ASCII. The result is a list separated by NUL characters and the code only checks the first list item which can be ASCII whereas following items are non-ASCII. Fix test__locale for the uk_UA locale on RHEL 7. (cherry picked from commit 899c7dc) Co-authored-by: Victor Stinner <vstinner@python.org> Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Set the LC_CTYPE locale to the LC_TIME locale even if nl_langinfo(ALT_DIGITS) result is ASCII. The result is a list separated by NUL characters and the code only checks the first list item which can be ASCII whereas following items are non-ASCII. Fix test__locale for the uk_UA locale on RHEL 7. Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Set the LC_CTYPE locale to the LC_TIME locale even if nl_langinfo(ALT_DIGITS) result is ASCII. The result is a list separated by NUL characters and the code only checks the first list item which can be ASCII whereas following items are non-ASCII.
Fix test__locale for the uk_UA locale on RHEL 7.