summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xLib/pydoc.py1
-rw-r--r--Lib/test/test_pydoc.py6
-rw-r--r--Misc/NEWS3
3 files changed, 10 insertions, 0 deletions
diff --git a/Lib/pydoc.py b/Lib/pydoc.py
index dd4fdfd..6475dec 100755
--- a/Lib/pydoc.py
+++ b/Lib/pydoc.py
@@ -1740,6 +1740,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()
diff --git a/Lib/test/test_pydoc.py b/Lib/test/test_pydoc.py
index 95a11af..03b3539 100644
--- a/Lib/test/test_pydoc.py
+++ b/Lib/test/test_pydoc.py
@@ -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):
diff --git a/Misc/NEWS b/Misc/NEWS
index 626b512..d111709 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -34,6 +34,9 @@ Core and Builtins
Library
-------
+- Issue #6121: pydoc now ignores leading and trailing spaces in the
+ argument to the 'help' function.
+
- Issue #6118: urllib.parse.quote_plus ignored the encoding and errors
arguments for strings with a space in them.