Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 19cbf8f

Browse filesBrowse files
authored
gh-120678: Guard against stdin.fileno() being unavailable (#121924)
1 parent ac07451 commit 19cbf8f
Copy full SHA for 19cbf8f

File tree

Expand file treeCollapse file tree

1 file changed

+14
-6
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+14
-6
lines changed

‎Lib/test/test_pyrepl/test_pyrepl.py

Copy file name to clipboardExpand all lines: Lib/test/test_pyrepl/test_pyrepl.py
+14-6Lines 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+
self.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)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.