https://github.com/python/cpython/commit/07d4b6313f6cb8d78da930dcf03daa0d6303e1ee
commit: 07d4b6313f6cb8d78da930dcf03daa0d6303e1ee
branch: 3.13
author: Miss Islington (bot) <[email protected]>
committer: vstinner <[email protected]>
date: 2025-05-28T16:08:08Z
summary:

[3.13] gh-133711: Fix test_readline.test_nonascii() for UTF-8 Mode (GH-134841) 
(#134852)

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

Skip the test if the Python UTF-8 Mode is enabled and the LC_CTYPE
encoding is not UTF-8.
(cherry picked from commit 4635115c3f1495fa20e553937df37861fffa7054)

Co-authored-by: Victor Stinner <[email protected]>

files:
M Lib/test/test_readline.py

diff --git a/Lib/test/test_readline.py b/Lib/test/test_readline.py
index 8b8772c66ee654..537a9fb0b2977b 100644
--- a/Lib/test/test_readline.py
+++ b/Lib/test/test_readline.py
@@ -1,6 +1,7 @@
 """
 Very minimal unittests for parts of the readline module.
 """
+import codecs
 import locale
 import os
 import sys
@@ -228,6 +229,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")

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to