make sure the builtin help function doesn't fail when sys.stdin is not a valid file (closes #11709)

Original patch by Amaury Forgeot d'Arc with a test by bdettmer.
This commit is contained in:
Benjamin Peterson 2014-06-07 20:14:26 -07:00
parent 96e0430dfb
commit 159824ea2a
3 changed files with 13 additions and 0 deletions

View file

@ -1417,6 +1417,8 @@ def pager(text):
def getpager():
"""Decide what method to use for paging through text."""
if not hasattr(sys.stdin, "isatty"):
return plainpager
if not hasattr(sys.stdout, "isatty"):
return plainpager
if not sys.stdin.isatty() or not sys.stdout.isatty():