]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.14] gh-133740: Fix regression in locale.nl_langinfo(ALT_DIGITS) (GH-136237) (GH...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Thu, 3 Jul 2025 11:04:30 +0000 (13:04 +0200)
committerGitHub <noreply@github.com>
Thu, 3 Jul 2025 11:04:30 +0000 (11:04 +0000)
There is no need to temporary switch locale for items ALT_DIGITS and ERA
if the nl_langinfo() result is empty (most locales).
(cherry picked from commit 5c984ae35e30f0533e6cc727d23cc158decf001c)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
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