gh-142353: Isolate tests from personal GNU Readline init files (#142370)

Isolate tests from personal Readline init files using `INPUTRC=/dev/null` trick.

Co-authored-by: Victor Stinner <vstinner@python.org>
This commit is contained in:
Bartosz Sławecki 2025-12-12 15:42:38 +01:00 committed by GitHub
parent a3a611b042
commit f564654bae
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View 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: