Skip to content

Commit 1c0f20e

Browse files
committed
gh-133740: Fix locale.nl_langinfo(ALT_DIGITS)
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.
1 parent a66bae8 commit 1c0f20e

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

Modules/_localemodule.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -692,7 +692,8 @@ _locale_nl_langinfo_impl(PyObject *module, int item)
692692
result = result != NULL ? result : "";
693693
char *oldloc = NULL;
694694
if (langinfo_constants[i].category != LC_CTYPE
695-
&& !is_all_ascii(result)
695+
// gh-133740: Always change the locale for ALT_DIGITS
696+
&& (item == ALT_DIGITS || !is_all_ascii(result))
696697
&& change_locale(langinfo_constants[i].category, &oldloc) < 0)
697698
{
698699
return NULL;

0 commit comments

Comments
 (0)