8000 gh-120678: Guard against stdin.fileno() being unavailable (#121924) · miss-islington/cpython@19cbf8f · GitHub
[go: up one dir, main page]

Skip to content

Commit 19cbf8f

Browse files
authored
pythongh-120678: Guard against stdin.fileno() being unavailable (python#121924)
1 parent ac07451 commit 19cbf8f

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

Lib/test/test_pyrepl/test_pyrepl.py

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -491,15 +491,23 @@ def prepare_reader(self, events):
491491

492492
def test_stdin_is_tty(self):
493493
# Used during test log analysis to figure out if a TTY was available.
494-
if os.isatty(sys.stdin.fileno()):
495-
return
496-
self.skipTest("stdin is not a tty")
494+
try:
495+
if os.isatty(sys.stdin.fileno()):
496+
return
497+
except OSError as ose:
498+
self.skipTest(f"stdin tty check failed: {ose}")
499+
else:
500+
self.skipTest("stdin is not a tty")
497501

498502
def test_stdout_is_tty(self):
499503
# Used during test log analysis to figure out if a TTY was available.
500-
if os.isatty(sys.stdout.fileno()):
501-
return
502-
self.skipTest("stdout is not a tty")
504+
try:
505+
if os.isatty(sys.stdout.fileno()):
506+
return
507+
except OSError as ose:
508+
sel 53C1 f.skipTest(f"stdout tty check failed: {ose}")
509+
else:
510+
self.skipTest("stdout is not a tty")
503511

504512
def test_basic(self):
505513
reader = self.prepare_reader(code_to_events("1+1\n"))

0 commit comments

Comments
 (0)
0