FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-133711: Fix test_readline.test_nonascii() for UTF-8 Mode by vstinner · Pull Request #134841 · python/cpython · GitHub

Repository navigation

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
8 changes: 8 additions & 0 deletions Lib/test/test_readline.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Very minimal unittests for parts of the readline module.
"""
import codecs
import locale
import os
import sys
Expand Down Expand Up @@ -231,6 +232,13 @@ def test_nonascii(self):
# 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}")
if sys.flags.utf8_mode:
encoding = locale.getencoding()
encoding = codecs.lookup(encoding).name # normalize the name
if encoding != "utf-8":
# gh-133711: The Python UTF-8 Mode ignores the LC_CTYPE locale
# and always use the UTF-8 encoding.
self.skipTest(f"the LC_CTYPE encoding is {encoding!r}")

try:
readline.add_history("\xEB\xEF")
Expand Down

Back | FazBrowse Home | New Git URL