From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Fri, 12 Dec 2025 15:08:08 +0000 (+0100) Subject: [3.14] gh-142353: Isolate tests from personal GNU Readline init files (GH-142370... X-Git-Tag: v3.14.3~256 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5e425c3f9629edf7e7cbade2e4cd29834eb9d4fa;p=thirdparty%2FPython%2Fcpython.git [3.14] gh-142353: Isolate tests from personal GNU Readline init files (GH-142370) (#142634) gh-142353: Isolate tests from personal GNU Readline init files (GH-142370) Isolate tests from personal Readline init files using `INPUTRC=/dev/null` trick. (cherry picked from commit f564654bae79c69e3de40dadbec2399f1423ffcf) Co-authored-by: Bartosz Sławecki Co-authored-by: Victor Stinner --- diff --git a/Lib/test/support/pty_helper.py b/Lib/test/support/pty_helper.py index 6587fd40333c..dbe7fa429096 100644 --- a/Lib/test/support/pty_helper.py +++ b/Lib/test/support/pty_helper.py @@ -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: