]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Patch #798145: Return correct information from nl_langinfo(RADIXCHAR).
authorMartin v. Löwis <martin@v.loewis.de>
Thu, 4 Sep 2003 18:26:07 +0000 (18:26 +0000)
committerMartin v. Löwis <martin@v.loewis.de>
Thu, 4 Sep 2003 18:26:07 +0000 (18:26 +0000)
Misc/NEWS
Modules/_localemodule.c

index 773923c14063894496925ce7872f9c9d87fe7df8..214eb3542225076c58427bf12fa4632179602175 100644 (file)
--- 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().
index 980302d4efd7aba0c175345537266d26e8c11d46..5862c1e59b192d42bf870f9527b0a02295408cca 100644 (file)
@@ -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));