mirror of
https://github.com/python/cpython.git
synced 2025-10-01 12:52:18 +00:00
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 c495e799ed
)
This commit is contained in:
parent
e7dbd06583
commit
c2740e8a26
1 changed files with 8 additions and 0 deletions
|
@ -3,6 +3,7 @@ Very minimal unittests for parts of the readline module.
|
||||||
"""
|
"""
|
||||||
from contextlib import ExitStack
|
from contextlib import ExitStack
|
||||||
from errno import EIO
|
from errno import EIO
|
||||||
|
import locale
|
||||||
import os
|
import os
|
||||||
import selectors
|
import selectors
|
||||||
import subprocess
|
import subprocess
|
||||||
|
@ -137,6 +138,13 @@ print("History length:", readline.get_current_history_length())
|
||||||
self.assertIn(b"History length: 0\r\n", output)
|
self.assertIn(b"History length: 0\r\n", output)
|
||||||
|
|
||||||
def test_nonascii(self):
|
def test_nonascii(self):
|
||||||
|
loc = locale.setlocale(locale.LC_CTYPE, None)
|
||||||
|
if loc in ('C', 'POSIX'):
|
||||||
|
# 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.
|
||||||
|
self.skipTest(f"the LC_CTYPE locale is {loc!r}")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
readline.add_history("\xEB\xEF")
|
readline.add_history("\xEB\xEF")
|
||||||
except UnicodeEncodeError as err:
|
except UnicodeEncodeError as err:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue