diff options
Diffstat (limited to 'Modules/_localemodule.c')
-rw-r--r-- | Modules/_localemodule.c | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/Modules/_localemodule.c b/Modules/_localemodule.c index 71c9146..95b370b 100644 --- a/Modules/_localemodule.c +++ b/Modules/_localemodule.c @@ -171,12 +171,6 @@ PyLocale_localeconv(PyObject* self) RESULT(#i, x); \ } while (0) - /* Numeric information */ - RESULT_STRING(decimal_point); - RESULT_STRING(thousands_sep); - x = copy_grouping(l->grouping); - RESULT("grouping", x); - /* Monetary information */ RESULT_STRING(int_curr_symbol); RESULT_STRING(currency_symbol); @@ -195,6 +189,32 @@ PyLocale_localeconv(PyObject* self) RESULT_INT(n_sep_by_space); RESULT_INT(p_sign_posn); RESULT_INT(n_sign_posn); + + /* Numeric information */ + PyObject *decimal_point, *thousands_sep; + const char *grouping; + if (_Py_GetLocaleconvNumeric(&decimal_point, + &thousands_sep, + &grouping) < 0) { + goto failed; + } + + if (PyDict_SetItemString(result, "decimal_point", decimal_point) < 0) { + Py_DECREF(decimal_point); + Py_DECREF(thousands_sep); + goto failed; + } + Py_DECREF(decimal_point); + + if (PyDict_SetItemString(result, "thousands_sep", thousands_sep) < 0) { + Py_DECREF(thousands_sep); + goto failed; + } + Py_DECREF(thousands_sep); + + x = copy_grouping(grouping); + RESULT("grouping", x); + return result; failed: |