summaryrefslogtreecommitdiffstats
path: root/Include/internal/pycore_fileutils.h
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@redhat.com>2018-11-20 15:20:16 (GMT)
committerGitHub <noreply@github.com>2018-11-20 15:20:16 (GMT)
commit02e6bf7f2025cddcbde6432f6b6396198ab313f4 (patch)
treed7c7a206e2f8c891fe4c41da8a3a46d0902bee13 /Include/internal/pycore_fileutils.h
parentd5d33681c1cd1df7731eb0fb7c0f297bc2f114e6 (diff)
downloadcpython-02e6bf7f2025cddcbde6432f6b6396198ab313f4.zip
cpython-02e6bf7f2025cddcbde6432f6b6396198ab313f4.tar.gz
cpython-02e6bf7f2025cddcbde6432f6b6396198ab313f4.tar.bz2
bpo-28604: Fix localeconv() for different LC_MONETARY (GH-10606)
locale.localeconv() now sets temporarily the LC_CTYPE locale to the LC_MONETARY locale if the two locales are different and monetary strings are non-ASCII. This temporary change affects other threads. Changes: * locale.localeconv() can now set LC_CTYPE to LC_MONETARY to decode monetary fields. * Add LocaleInfo.grouping_buffer: copy localeconv() grouping string since it can be replaced anytime if a different thread calls localeconv(). * _Py_GetLocaleconvNumeric() now requires a "struct lconv *" structure, so locale.localeconv() now longer calls localeconv() twice. Moreover, the function now requires all arguments to be non-NULL. * Rename STATIC_LOCALE_INFO_INIT to LocaleInfo_STATIC_INIT. * Move _Py_GetLocaleconvNumeric() definition from fileutils.h to pycore_fileutils.h. pycore_fileutils.h now includes locale.h. * The _locale module is now built with Py_BUILD_CORE defined.
Diffstat (limited to 'Include/internal/pycore_fileutils.h')
-rw-r--r--Include/internal/pycore_fileutils.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/Include/internal/pycore_fileutils.h b/Include/internal/pycore_fileutils.h
index d577e09..98eb258 100644
--- a/Include/internal/pycore_fileutils.h
+++ b/Include/internal/pycore_fileutils.h
@@ -8,6 +8,8 @@ extern "C" {
# error "Py_BUILD_CORE must be defined to include this header"
#endif
+#include <locale.h> /* struct lconv */
+
PyAPI_FUNC(int) _Py_DecodeUTF8Ex(
const char *arg,
Py_ssize_t arglen,
@@ -30,6 +32,11 @@ PyAPI_FUNC(wchar_t*) _Py_DecodeUTF8_surrogateescape(
PyAPI_FUNC(int) _Py_GetForceASCII(void);
+PyAPI_FUNC(int) _Py_GetLocaleconvNumeric(
+ struct lconv *lc,
+ PyObject **decimal_point,
+ PyObject **thousands_sep);
+
#ifdef __cplusplus
}
#endif