Skip to content

Commit c2740e8

Browse files
miss-islingtonvstinner
authored andcommitted
Skip test_readline.test_nonascii() on C locale (GH-5203) (#5204)
bpo-29240: On FreeBSD, if the LC_CTYPE locale is "C" or "POSIX", writing and reading non-ASCII bytes into/from a TTY works, but readline or ncurses ignores non-ASCII bytes on read. (cherry picked from commit c495e79)
1 parent e7dbd06 commit c2740e8

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Lib/test/test_readline.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"""
44
from contextlib import ExitStack
55
from errno import EIO
6+
import locale
67
import os
78
import selectors
89
import subprocess
@@ -137,6 +138,13 @@ def test_auto_history_disabled(self):
137138
self.assertIn(b"History length: 0\r\n", output)
138139

139140
def test_nonascii(self):
141+
loc = locale.setlocale(locale.LC_CTYPE, None)
142+
if loc in ('C', 'POSIX'):
143+
# bpo-29240: On FreeBSD, if the LC_CTYPE locale is C or POSIX,
144+
# writing and reading non-ASCII bytes into/from a TTY works, but
145+
# readline or ncurses ignores non-ASCII bytes on read.
146+
self.skipTest(f"the LC_CTYPE locale is {loc!r}")
147+
140148
try:
141149
readline.add_history("\xEB\xEF")
142150
except UnicodeEncodeError as err:

0 commit comments

Comments
 (0)