From 5470e1ac9df2af7091c4c35709f7fb0c7aabbf62 Mon Sep 17 00:00:00 2001 From: stepan Date: Wed, 22 Jul 2026 16:26:37 +0200 Subject: [PATCH] Minor shaded JLine usage fixes --- .../com/oracle/graal/python/shell/JLineConsoleHandler.java | 2 +- .../com.oracle.graal.python.test/src/tests/test_repl.py | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/graalpython/com.oracle.graal.python.shell/src/com/oracle/graal/python/shell/JLineConsoleHandler.java b/graalpython/com.oracle.graal.python.shell/src/com/oracle/graal/python/shell/JLineConsoleHandler.java index 5cfec4a0cc..94b4f500f3 100644 --- a/graalpython/com.oracle.graal.python.shell/src/com/oracle/graal/python/shell/JLineConsoleHandler.java +++ b/graalpython/com.oracle.graal.python.shell/src/com/oracle/graal/python/shell/JLineConsoleHandler.java @@ -98,7 +98,7 @@ public void initializeReadline(Value readlineModule) { Terminal terminal; Object[] signalHandlers = stashSignalHandlers(); try { - terminal = TerminalBuilder.builder().jna(false).streams(inputStream, outputStream).system(true).build(); + terminal = TerminalBuilder.builder().streams(inputStream, outputStream).system(true).build(); } catch (IOException ex) { throw new RuntimeException("unexpected error opening console reader", ex); } finally { diff --git a/graalpython/com.oracle.graal.python.test/src/tests/test_repl.py b/graalpython/com.oracle.graal.python.test/src/tests/test_repl.py index aa2ab1d425..9581b97494 100644 --- a/graalpython/com.oracle.graal.python.test/src/tests/test_repl.py +++ b/graalpython/com.oracle.graal.python.test/src/tests/test_repl.py @@ -111,7 +111,9 @@ def validate_repl(stdin, python_args=(), ignore_preamble=True, extra_input_and_o rlist, _, _ = select.select([pty_parent], [], [], 60) assert pty_parent in rlist, f"Timed out waiting for REPL output. Output: {whole_out}{out}" out += os.read(pty_parent, 1024).decode('utf-8') - out = re.sub(r'\x1b\[(?:\?2004[hl]|\d+[A-G])', '', out) + # Strip terminal control sequences, including the mode 2027 and device-attributes + # probes emitted by JLine 4 while detecting grapheme-cluster support. + out = re.sub(r'\x1b\[(?:\?2004[hl]|\?2027\$p|c|\d+[A-G])', '', out) out = re.sub(r'\r+\n', '\n', out) if out.endswith(('\n... ', '>>> ')): prompt = out[:3] @@ -134,7 +136,7 @@ def validate_repl(stdin, python_args=(), ignore_preamble=True, extra_input_and_o os.write(pty_parent, b'\x04') # Ctrl-D / EOF proc.wait(timeout=60) out = os.read(pty_parent, 1024).decode('utf-8') - out = re.sub(r'\x1b\[\?2004[hl]', '', out) + out = re.sub(r'\x1b\[(?:\?2004[hl]|\?2027\$p|c)', '', out) assert not out.strip(), f"Garbage after EOF:\n{out!r}" return else: