8000 gh-133711: Fix test_readline.test_nonascii() for UTF-8 Mode by vstinner · Pull Request #134841 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-133711: Fix test_readline.test_nonascii() for UTF-8 Mode #134841

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 28, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Lib/test/test_readline.py
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
Loading
0