]> granicus.if.org Git - python/commitdiff
Skip test_readline.test_nonascii() on C locale (GH-5203) (#5204)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Tue, 16 Jan 2018 17:27:29 +0000 (09:27 -0800)
committerVictor Stinner <victor.stinner@gmail.com>
Tue, 16 Jan 2018 17:27:29 +0000 (18:27 +0100)
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 c495e799ed376af91ae2ddf6c4bcc592490fe294)

Lib/test/test_readline.py

index 9c979652a1d0e954c7fb1a19990a926fde97a554..dd9d3b57fcbcd063a0be8f01ba1ff4c5b61a1efc 100644 (file)
@@ -3,6 +3,7 @@ Very minimal unittests for parts of the readline module.
 """
 from contextlib import ExitStack
 from errno import EIO
+import locale
 import os
 import selectors
 import subprocess
@@ -137,6 +138,13 @@ print("History length:", readline.get_current_history_length())
         self.assertIn(b"History length: 0\r\n", output)
 
     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:
             readline.add_history("\xEB\xEF")
         except UnicodeEncodeError as err: