From 50999aa171ad60c17ecb4286c7e96e306322e46a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Martin=20v=2E=20L=C3=B6wis?= Date: Thu, 4 Sep 2003 18:26:07 +0000 Subject: [PATCH] Patch #798145: Return correct information from nl_langinfo(RADIXCHAR). --- Misc/NEWS | 2 ++ Modules/_localemodule.c | 12 ++++++++++++ 2 files changed, 14 insertions(+) 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)); -- 2.47.3