Merged revisions 72966 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r72966 | r.david.murray | 2009-05-27 16:07:21 -0400 (Wed, 27 May 2009) | 4 lines

  fix issue #6121 by stripping spaces from the argument in the 'help'
  function.
........
diff --git a/Lib/pydoc.py b/Lib/pydoc.py
index 3afb981..1103b01 100755
--- a/Lib/pydoc.py
+++ b/Lib/pydoc.py
@@ -1751,6 +1751,7 @@
 
     def help(self, request):
         if type(request) is type(''):
+            request = request.strip()
             if request == 'help': self.intro()
             elif request == 'keywords': self.listkeywords()
             elif request == 'symbols': self.listsymbols()
diff --git a/Lib/test/test_pydoc.py b/Lib/test/test_pydoc.py
index 91a9977..7990d3a 100644
--- a/Lib/test/test_pydoc.py
+++ b/Lib/test/test_pydoc.py
@@ -237,6 +237,14 @@
         self.assertEqual(expected, result,
             "documentation for missing module found")
 
+    def test_input_strip(self):
+        missing_module = " test.i_am_not_here "
+        result = run_pydoc(missing_module)
+        expected = missing_pattern % missing_module.strip()
+        self.assertEqual(expected, result,
+            "white space was not stripped from module name "
+            "or other error output mismatch")
+
 
 class TestDescriptions(unittest.TestCase):
 
diff --git a/Misc/NEWS b/Misc/NEWS
index 148d130..5b0f818 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -50,6 +50,9 @@
 Library
 -------
 
+- Issue #6121: pydoc now ignores leading and trailing spaces in the
+  argument to the 'help' function.
+
 - Issue #6050: Don't fail extracting a directory from a zipfile if
   the directory already exists.