mirror of
https://github.com/python/cpython.git
synced 2025-08-24 18:55:00 +00:00
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:
parent
96e0430dfb
commit
159824ea2a
3 changed files with 13 additions and 0 deletions
|
@ -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():
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue