From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Thu, 3 Jul 2025 11:04:30 +0000 (+0200) Subject: [3.14] gh-133740: Fix regression in locale.nl_langinfo(ALT_DIGITS) (GH-136237) (GH... X-Git-Tag: v3.14.0b4~42 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=150262db4c4a17aea0b7de411efa91f1eb7e70aa;p=thirdparty%2FPython%2Fcpython.git [3.14] gh-133740: Fix regression in locale.nl_langinfo(ALT_DIGITS) (GH-136237) (GH-136240) 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 --- diff --git a/Modules/_localemodule.c b/Modules/_localemodule.c index c1f56008b7c4..41e6d48b1dbd 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