]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-34527: Fix FreeBSD with POSIX locale (GH-8975)
authorVictor Stinner <vstinner@redhat.com>
Tue, 28 Aug 2018 12:53:31 +0000 (14:53 +0200)
committerGitHub <noreply@github.com>
Tue, 28 Aug 2018 12:53:31 +0000 (14:53 +0200)
On FreeBSD, Py_DecodeLocale() and Py_EncodeLocale() now also forces
the ASCII encoding if the LC_CTYPE locale is "POSIX", not only if
the LC_CTYPE locale is "C".

Misc/NEWS.d/next/Core and Builtins/2018-08-28-11-53-39.bpo-34527.aBEX9b.rst [new file with mode: 0644]
Python/fileutils.c

diff --git a/Misc/NEWS.d/next/Core and Builtins/2018-08-28-11-53-39.bpo-34527.aBEX9b.rst b/Misc/NEWS.d/next/Core and Builtins/2018-08-28-11-53-39.bpo-34527.aBEX9b.rst
new file mode 100644 (file)
index 0000000..9fce794
--- /dev/null
@@ -0,0 +1,3 @@
+On FreeBSD, Py_DecodeLocale() and Py_EncodeLocale() now also forces the
+ASCII encoding if the LC_CTYPE locale is "POSIX", not only if the LC_CTYPE
+locale is "C".
index b9638d2df513bee4c3dc4f049a6a8716b536c629..b8e489125e3c69ff760e0283a5023e2301e3e528 100644 (file)
@@ -132,7 +132,7 @@ check_force_ascii(void)
     loc = setlocale(LC_CTYPE, NULL);
     if (loc == NULL)
         goto error;
-    if (strcmp(loc, "C") != 0) {
+    if (strcmp(loc, "C") != 0 && strcmp(loc, "POSIX") != 0) {
         /* the LC_CTYPE locale is different than C */
         return 0;
     }