summaryrefslogtreecommitdiffstats
path: root/Lib/pydoc.py
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2014-06-08 03:14:26 (GMT)
committerBenjamin Peterson <benjamin@python.org>2014-06-08 03:14:26 (GMT)
commit159824ea2a1872dadef69a229fb294c571d2ac73 (patch)
tree6796bae35982004fb1932a2f93bd97a36fdfcccd /Lib/pydoc.py
parent96e0430dfb36c5fa336684601bf271b0ce43e367 (diff)
downloadcpython-159824ea2a1872dadef69a229fb294c571d2ac73.zip
cpython-159824ea2a1872dadef69a229fb294c571d2ac73.tar.gz
cpython-159824ea2a1872dadef69a229fb294c571d2ac73.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-xLib/pydoc.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/pydoc.py b/Lib/pydoc.py
index 2dee6ee..cc43684 100755
--- a/Lib/pydoc.py
+++ b/Lib/pydoc.py
@@ -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():