Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions Lib/test/test_capi/test_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,13 +310,15 @@ def check_run_interactive(self, run, encode_filename, use_loop=False):
# supported". In this case, run the test without redirecting
# stderr to a temporary file.
self._check_run_interactive(run, encode_filename, use_loop)
else:
with tempfile.TemporaryFile() as tmp:
try:
os.dup2(tmp.fileno(), STDERR_FD)
self._check_run_interactive(run, encode_filename, use_loop)
finally:
os.dup2(stderr_copy, STDERR_FD)
return

with tempfile.TemporaryFile() as tmp:
try:
os.dup2(tmp.fileno(), STDERR_FD)
self._check_run_interactive(run, encode_filename, use_loop)
finally:
os.dup2(stderr_copy, STDERR_FD)
os.close(stderr_copy)

def test_run_interactiveone(self):
# Test PyRun_InteractiveOne()
Expand Down
Loading