]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-121359: Run test_pyrepl in isolated mode (#121414)
authorVictor Stinner <vstinner@python.org>
Fri, 5 Jul 2024 20:30:08 +0000 (22:30 +0200)
committerGitHub <noreply@github.com>
Fri, 5 Jul 2024 20:30:08 +0000 (22:30 +0200)
run_repl() now pass the -I option (isolated mode) to Python if the
'env' parameter is not set.

Lib/test/test_pyrepl/test_pyrepl.py

index 93c80467a04546b80424ace066739b69af1e6134..7621b8af808f532808272a43e0e6f6abe5c8e538 100644 (file)
@@ -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,