diff options
author | Benjamin Peterson <benjamin@python.org> | 2014-06-08 03:14:26 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2014-06-08 03:14:26 (GMT) |
commit | 75a55c32759c66cac479e6b9faf10e836e00f0d6 (patch) | |
tree | 6b1440a33c8688e029dd9cbcf524ee5ab4f49ae2 /Lib/pydoc.py | |
parent | 7e1eb5c713c6b14e5c71155f206d37cc16541300 (diff) | |
download | cpython-75a55c32759c66cac479e6b9faf10e836e00f0d6.zip cpython-75a55c32759c66cac479e6b9faf10e836e00f0d6.tar.gz cpython-75a55c32759c66cac479e6b9faf10e836e00f0d6.tar.bz2 |
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.
Diffstat (limited to 'Lib/pydoc.py')
-rwxr-xr-x | Lib/pydoc.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/pydoc.py b/Lib/pydoc.py index 254fe40..218fd30 100755 --- a/Lib/pydoc.py +++ b/Lib/pydoc.py @@ -1377,6 +1377,8 @@ def getpager(): """Decide what method to use for paging through text.""" if type(sys.stdout) is not types.FileType: return plainpager + if not hasattr(sys.stdin, "isatty"): + return plainpager if not sys.stdin.isatty() or not sys.stdout.isatty(): return plainpager if 'PAGER' in os.environ: |