summaryrefslogtreecommitdiffstats
path: root/Python/fileutils.c
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@redhat.com>2018-11-23 12:08:26 (GMT)
committerGitHub <noreply@github.com>2018-11-23 12:08:26 (GMT)
commit353933e712b6c7f7ba9a9a50bd5bd472db7c35d0 (patch)
treeb91db22bcb76a9459a0495c96f21524368af401c /Python/fileutils.c
parente89607c0fc8d6edbf19c06ba42ff0f00e6c4273f (diff)
downloadcpython-353933e712b6c7f7ba9a9a50bd5bd472db7c35d0.zip
cpython-353933e712b6c7f7ba9a9a50bd5bd472db7c35d0.tar.gz
cpython-353933e712b6c7f7ba9a9a50bd5bd472db7c35d0.tar.bz2
bpo-34523: Fix C locale coercion on FreeBSD CURRENT (GH-10672)
bpo-34523, bpo-35290: C locale coercion now resets the Python internal "force ASCII" mode. This change fix the filesystem encoding on FreeBSD CURRENT, which has a new "C.UTF-8" locale, when the UTF-8 mode is disabled. Add _Py_ResetForceASCII(): _Py_SetLocaleFromEnv() now calls it.
Diffstat (limited to 'Python/fileutils.c')
-rw-r--r--Python/fileutils.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/Python/fileutils.c b/Python/fileutils.c
index 033c2ff..366bd00 100644
--- a/Python/fileutils.c
+++ b/Python/fileutils.c
@@ -231,6 +231,13 @@ _Py_GetForceASCII(void)
}
+void
+_Py_ResetForceASCII(void)
+{
+ force_ascii = -1;
+}
+
+
static int
encode_ascii(const wchar_t *text, char **str,
size_t *error_pos, const char **reason,
@@ -296,6 +303,12 @@ _Py_GetForceASCII(void)
{
return 0;
}
+
+void
+_Py_ResetForceASCII(void)
+{
+ /* nothing to do */
+}
#endif /* !defined(__APPLE__) && !defined(__ANDROID__) && !defined(MS_WINDOWS) */