]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-133740: Fix regression in locale.nl_langinfo(ALT_DIGITS) (GH-136237)
authorSerhiy Storchaka <storchaka@gmail.com>
Thu, 3 Jul 2025 10:39:14 +0000 (13:39 +0300)
committerGitHub <noreply@github.com>
Thu, 3 Jul 2025 10:39:14 +0000 (10:39 +0000)
There is no need to temporary switch locale for items ALT_DIGITS and ERA
if the nl_langinfo() result is empty (most locales).

Modules/_localemodule.c

index c1f56008b7c49e3c9680f51cc77835ed49fc527c..41e6d48b1dbd9bb96acced3f9cb19923c8be4c35 100644 (file)
@@ -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