File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1417,6 +1417,8 @@ def pager(text):
14171417
14181418def getpager ():
14191419 """Decide what method to use for paging through text."""
1420+ if not hasattr (sys .stdin , "isatty" ):
1421+ return plainpager
14201422 if not hasattr (sys .stdout , "isatty" ):
14211423 return plainpager
14221424 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 @@ -22,6 +22,9 @@ Core and Builtins
2222Library
2323-------
2424
25+ - Issue #11709: Fix the pydoc.help function to not fail when sys.stdin is not a
26+ valid file.
27+
2528- Issue #13223: Fix pydoc.writedoc so that the HTML documentation for methods
2629 that use 'self' in the example code is generated correctly.
2730
You can’t perform that action at this time.
0 commit comments