File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1415,6 +1415,8 @@ def pager(text):
14151415
14161416def getpager ():
14171417 """Decide what method to use for paging through text."""
1418+ if not hasattr (sys .stdin , "isatty" ):
1419+ return plainpager
14181420 if not hasattr (sys .stdout , "isatty" ):
14191421 return plainpager
14201422 if not sys .stdin .isatty () or not sys .stdout .isatty ():
Original file line number Diff line number Diff line change @@ -446,6 +446,14 @@ def test_issue8225(self):
446446 result , doc_loc = get_pydoc_text (xml .etree )
447447 self .assertEqual (doc_loc , "" , "MODULE DOCS incorrectly includes a link" )
448448
449+ def test_getpager_with_stdin_none (self ):
450+ previous_stdin = sys .stdin
451+ try :
452+ sys .stdin = None
453+ pydoc .getpager () # Shouldn't fail.
454+ finally :
455+ sys .stdin = previous_stdin
456+
449457 def test_non_str_name (self ):
450458 # issue14638
451459 # Treat illegal (non-str) name like no name
Original file line number Diff line number Diff line change @@ -94,6 +94,9 @@ Library
9494
9595- Issue #20578: Add io.BufferedIOBase.readinto1.
9696
97+ - Issue #11709: Fix the pydoc.help function to not fail when sys.stdin is not a
98+ valid file.
99+
97100- Issue #21515: tempfile.TemporaryFile now uses os.O_TMPFILE flag is available.
98101
99102- Issue #13223: Fix pydoc.writedoc so that the HTML documentation for methods
You can’t perform that action at this time.
0 commit comments