From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Fri, 5 Jul 2024 20:55:14 +0000 (+0200) Subject: [3.13] gh-121359: Run test_pyrepl in isolated mode (GH-121414) (#121417) X-Git-Tag: v3.13.0b4~114 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4aa0c5ec34836a026d06e556784c41e0eeb807b3;p=thirdparty%2FPython%2Fcpython.git [3.13] gh-121359: Run test_pyrepl in isolated mode (GH-121414) (#121417) gh-121359: Run test_pyrepl in isolated mode (GH-121414) run_repl() now pass the -I option (isolated mode) to Python if the 'env' parameter is not set. (cherry picked from commit 6239d41527d5977aa5d44e4b894d719bc045860e) Co-authored-by: Victor Stinner --- 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,