Skip to content

[3.9] bpo-13886: Skip PTY non-ASCII tests if readline is loaded (GH-30631) #30635

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
Jan 17, 2022
Merged
Show file tree
Hide file tree
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
16 changes: 14 additions & 2 deletions Lib/test/test_builtin.py
Original file line number Diff line number Diff line change
Expand Up @@ -1980,12 +1980,24 @@ def test_input_tty(self):
# is different and invokes GNU readline if available).
self.check_input_tty("prompt", b"quux")

def skip_if_readline(self):
# bpo-13886: When the readline module is loaded, PyOS_Readline() uses
# the readline implementation. In some cases, the Python readline
# callback rlhandler() is called by readline with a string without
# non-ASCII characters. Skip tests on non-ASCII characters if the
# readline module is loaded, since test_builtin is not intented to test
# the readline module, but the builtins module.
if 'readline' in sys.modules:
self.skipTest("the readline module is loaded")

def test_input_tty_non_ascii(self):
# Check stdin/stdout encoding is used when invoking GNU readline
self.skip_if_readline()
# Check stdin/stdout encoding is used when invoking PyOS_Readline()
self.check_input_tty("prompté", b"quux\xe9", "utf-8")

def test_input_tty_non_ascii_unicode_errors(self):
# Check stdin/stdout error handler is used when invoking GNU readline
self.skip_if_readline()
# Check stdin/stdout error handler is used when invoking PyOS_Readline()
self.check_input_tty("prompté", b"quux\xe9", "ascii")

def test_input_no_stdout_fileno(self):
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Skip test_builtin PTY tests on non-ASCII characters if the readline module
is loaded. The readline module changes input() behavior, but test_builtin is
not intented to test the readline module. Patch by Victor Stinner.