Commit d1b097f8 authored by Victor Stinner's avatar Victor Stinner

Issue #13415: test_curses skips unencodable characters

parent eee0e441
......@@ -267,11 +267,18 @@ def test_issue6243(stdscr):
def test_unget_wch(stdscr):
if not hasattr(curses, 'unget_wch'):
return
import locale
encoding = locale.getpreferredencoding()
for ch in ('a', '\xe9', '\u20ac', '\U0010FFFF'):
try:
ch.encode(encoding)
except UnicodeEncodeError:
continue
try:
curses.unget_wch(ch)
except Exception as err:
raise Exception("unget_wch(%a) failed: %s" % (ch, err))
raise Exception("unget_wch(%a) failed with locale encoding %s: %s"
% (ch, encoding, err))
read = stdscr.get_wch()
read = chr(read)
if read != ch:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment