https://github.com/python/cpython/commit/5c984ae35e30f0533e6cc727d23cc158decf001c
commit: 5c984ae35e30f0533e6cc727d23cc158decf001c
branch: main
author: Serhiy Storchaka <[email protected]>
committer: serhiy-storchaka <[email protected]>
date: 2025-07-03T10:39:14Z
summary:

gh-133740: Fix regression in locale.nl_langinfo(ALT_DIGITS) (GH-136237)

There is no need to temporary switch locale for items ALT_DIGITS and ERA
if the nl_langinfo() result is empty (most locales).

files:
M Modules/_localemodule.c

diff --git a/Modules/_localemodule.c b/Modules/_localemodule.c
index c1f56008b7c49e..41e6d48b1dbd9b 100644
--- a/Modules/_localemodule.c
+++ b/Modules/_localemodule.c
@@ -692,7 +692,7 @@ _locale_nl_langinfo_impl(PyObject *module, int item)
             result = result != NULL ? result : "";
             char *oldloc = NULL;
             if (langinfo_constants[i].category != LC_CTYPE
-                && (
+                && *result && (
 #ifdef __GLIBC__
                     // gh-133740: Always change the locale for ALT_DIGITS and 
ERA
 #  ifdef ALT_DIGITS

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to