Skip to content

Commit 4ff3887

Browse files
authored
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".
1 parent 204fb45 commit 4ff3887

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
On FreeBSD, Py_DecodeLocale() and Py_EncodeLocale() now also forces the
2+
ASCII encoding if the LC_CTYPE locale is "POSIX", not only if the LC_CTYPE
3+
locale is "C".

Python/fileutils.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ check_force_ascii(void)
132132
loc = setlocale(LC_CTYPE, NULL);
133133
if (loc == NULL)
134134
goto error;
135-
if (strcmp(loc, "C") != 0) {
135+
if (strcmp(loc, "C") != 0 && strcmp(loc, "POSIX") != 0) {
136136
/* the LC_CTYPE locale is different than C */
137137
return 0;
138138
}

0 commit comments

Comments
 (0)