]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-142353: Isolate tests from personal GNU Readline init files (#142370)
authorBartosz Sławecki <bartosz@ilikepython.com>
Fri, 12 Dec 2025 14:42:38 +0000 (15:42 +0100)
committerGitHub <noreply@github.com>
Fri, 12 Dec 2025 14:42:38 +0000 (15:42 +0100)
Isolate tests from personal Readline init files using `INPUTRC=/dev/null` trick.

Co-authored-by: Victor Stinner <vstinner@python.org>
Lib/test/support/pty_helper.py

index 6587fd40333c5124eb58c803e753505cb128673b..dbe7fa429096fc662034b5430ff30b67379157e6 100644 (file)
@@ -15,6 +15,14 @@ def run_pty(script, input=b"dummy input\r", env=None):
     output = bytearray()
     [master, slave] = pty.openpty()
     args = (sys.executable, '-c', script)
+
+    # Isolate readline from personal init files by setting INPUTRC
+    # to an empty file. See also GH-142353.
+    if env is None:
+        env = {**os.environ.copy(), "INPUTRC": os.devnull}
+    else:
+        env.setdefault("INPUTRC", os.devnull)
+
     proc = subprocess.Popen(args, stdin=slave, stdout=slave, stderr=slave, env=env)
     os.close(slave)
     with ExitStack() as cleanup: