From 4ff38870b1de8a3add5357edf125c2866bc42b54 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Tue, 28 Aug 2018 14:53:31 +0200 Subject: bpo-34527: Fix FreeBSD with POSIX locale (GH-8975) 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". --- .../next/Core and Builtins/2018-08-28-11-53-39.bpo-34527.aBEX9b.rst | 3 +++ Python/fileutils.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 Misc/NEWS.d/next/Core and Builtins/2018-08-28-11-53-39.bpo-34527.aBEX9b.rst 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 index 0000000..9fce794 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2018-08-28-11-53-39.bpo-34527.aBEX9b.rst @@ -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". diff --git a/Python/fileutils.c b/Python/fileutils.c index b9638d2..b8e4891 100644 --- a/Python/fileutils.c +++ b/Python/fileutils.c @@ -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; } -- cgit v0.12