From 159824ea2a1872dadef69a229fb294c571d2ac73 Mon Sep 17 00:00:00 2001 From: Benjamin Peterson Date: Sat, 7 Jun 2014 20:14:26 -0700 Subject: 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. --- Lib/pydoc.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'Lib/pydoc.py') diff --git a/Lib/pydoc.py b/Lib/pydoc.py index 2dee6eee23..cc43684f19 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(): -- cgit v1.2.1