From: Victor Stinner Date: Fri, 5 Jul 2024 20:30:08 +0000 (+0200) Subject: gh-121359: Run test_pyrepl in isolated mode (#121414) X-Git-Tag: v3.14.0a1~1214 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6239d41527d5977aa5d44e4b894d719bc045860e;p=thirdparty%2FPython%2Fcpython.git gh-121359: Run test_pyrepl in isolated mode (#121414) run_repl() now pass the -I option (isolated mode) to Python if the 'env' parameter is not set. --- diff --git a/Lib/test/test_pyrepl/test_pyrepl.py b/Lib/test/test_pyrepl/test_pyrepl.py index 93c80467a045..7621b8af808f 100644 --- a/Lib/test/test_pyrepl/test_pyrepl.py +++ b/Lib/test/test_pyrepl/test_pyrepl.py @@ -927,8 +927,11 @@ class TestMain(TestCase): def run_repl(self, repl_input: str | list[str], env: dict | None = None) -> tuple[str, int]: master_fd, slave_fd = pty.openpty() + cmd = [sys.executable, "-i", "-u"] + if env is None: + cmd.append("-I") process = subprocess.Popen( - [sys.executable, "-i", "-u"], + cmd, stdin=slave_fd, stdout=slave_fd, stderr=slave_fd,