From: Martin v. Löwis Date: Thu, 4 Sep 2003 18:26:07 +0000 (+0000) Subject: Patch #798145: Return correct information from nl_langinfo(RADIXCHAR). X-Git-Tag: v2.3.1~90 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=50999aa171ad60c17ecb4286c7e96e306322e46a;p=thirdparty%2FPython%2Fcpython.git Patch #798145: Return correct information from nl_langinfo(RADIXCHAR). --- diff --git a/Misc/NEWS b/Misc/NEWS index 773923c14063..214eb3542225 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -20,6 +20,8 @@ Core and builtins Extension modules ----------------- +- Patch #798145: Return correct information from nl_langinfo(RADIXCHAR). + - Bug #797447: Correct confusing error message for unsupported locales. - Patch #798534: fixed memory leak in os.popen(). diff --git a/Modules/_localemodule.c b/Modules/_localemodule.c index 980302d4efd7..5862c1e59b19 100644 --- a/Modules/_localemodule.c +++ b/Modules/_localemodule.c @@ -579,6 +579,18 @@ PyLocale_nl_langinfo(PyObject* self, PyObject* args) /* Check whether this is a supported constant. GNU libc sometimes returns numeric values in the char* return value, which would crash PyString_FromString. */ +#ifdef RADIXCHAR + if (saved_numeric) { + if(item == RADIXCHAR) { + Py_INCREF(decimal_point); + return decimal_point; + } + if(item == THOUSEP) { + Py_INCREF(thousands_sep); + return thousands_sep; + } + } +#endif for (i = 0; langinfo_constants[i].name; i++) if (langinfo_constants[i].value == item) return PyString_FromString(nl_langinfo(item));