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/test/test_pydoc.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'Lib/test/test_pydoc.py') diff --git a/Lib/test/test_pydoc.py b/Lib/test/test_pydoc.py index 188c4c26fe..542b433cb6 100644 --- a/Lib/test/test_pydoc.py +++ b/Lib/test/test_pydoc.py @@ -446,6 +446,14 @@ class PydocDocTest(unittest.TestCase): result, doc_loc = get_pydoc_text(xml.etree) self.assertEqual(doc_loc, "", "MODULE DOCS incorrectly includes a link") + def test_getpager_with_stdin_none(self): + previous_stdin = sys.stdin + try: + sys.stdin = None + pydoc.getpager() # Shouldn't fail. + finally: + sys.stdin = previous_stdin + def test_non_str_name(self): # issue14638 # Treat illegal (non-str) name like no name -- cgit v1.2.1