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.
This commit is contained in:
Victor Stinner 2018-11-23 13:08:26 +01:00 committed by GitHub
parent e89607c0fc
commit 353933e712
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 29 additions and 4 deletions

View file

@ -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) */