]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Merged revisions 72968 via svnmerge from
authorR. David Murray <rdmurray@bitdance.com>
Wed, 27 May 2009 22:11:32 +0000 (22:11 +0000)
committerR. David Murray <rdmurray@bitdance.com>
Wed, 27 May 2009 22:11:32 +0000 (22:11 +0000)
svn+ssh://pythondev@svn.python.org/python/branches/py3k

................
  r72968 | r.david.murray | 2009-05-27 16:56:59 -0400 (Wed, 27 May 2009) | 10 lines

  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.
  ........
................

Lib/pydoc.py
Lib/test/test_pydoc.py
Misc/NEWS

index 2aea8c0fa2c3d6bbc695a7523b17dc32c44737bc..c632212d5b9f521a1ed4d123f26678aee2db0ea2 100755 (executable)
@@ -1739,6 +1739,7 @@ has the same effect as typing a particular string at the help> prompt.
 
     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()
index 95a11af977515365264735f53b7b807c61c217a9..03b353910ce7bad36d873955e2fd6b12ac37a556 100644 (file)
@@ -254,6 +254,12 @@ class PyDocDocTest(unittest.TestCase):
         self.assertEqual(expected, result,
             "documentation for missing module found")
 
+    def test_input_strip(self):
+        missing_module = " test.i_am_not_here "
+        result = str(run_pydoc(missing_module), 'ascii')
+        expected = missing_pattern % missing_module.strip()
+        self.assertEqual(expected, result)
+
 
 class TestDescriptions(unittest.TestCase):
 
index 7c6512e141d9db5019175b939a91ae5fb11dccc2..a3ac2b09150b6331df96385115fa8deb4fe81564 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -65,6 +65,9 @@ Core and Builtins
 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.