Skip to content

Commit 80a0d98

Browse files
committed
Make -I customizable in spawn_repl
1 parent b8d3fdd commit 80a0d98

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

Lib/test/test_repl.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
raise unittest.SkipTest("test module requires subprocess")
2929

3030

31-
def spawn_repl(*args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, custom=False, **kw):
31+
def spawn_repl(*args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, custom=False, isolated=True, **kw):
3232
"""Run the Python REPL with the given arguments.
3333
3434
kw is extra keyword args to pass to subprocess.Popen. Returns a Popen
@@ -42,7 +42,10 @@ def spawn_repl(*args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, custom=F
4242
# path may be used by PyConfig_Get("module_search_paths") to build the
4343
# default module search path.
4444
stdin_fname = os.path.join(os.path.dirname(sys.executable), "<stdin>")
45-
cmd_line = [stdin_fname, '-I']
45+
cmd_line = [stdin_fname]
46+
# Isolated mode implies -EPs and ignores PYTHON* variables.
47+
if isolated:
48+
cmd_line.append('-I')
4649
# Don't re-run the built-in REPL from interactive mode
4750
# if we're testing a custom REPL (such as the asyncio REPL).
4851
if not custom:

0 commit comments

Comments
 (0)