Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1f1b9d3

Browse files
committed
Merged revisions 72966 via svnmerge from
svn+ssh://[email protected]/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. ........
1 parent ed23ab6 commit 1f1b9d3

3 files changed

Lines changed: 10 additions & 0 deletions

File tree

Lib/pydoc.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1740,6 +1740,7 @@ def getline(self, prompt):
17401740

17411741
def help(self, request):
17421742
if type(request) is type(''):
1743+
request = request.strip()
17431744
if request == 'help': self.intro()
17441745
elif request == 'keywords': self.listkeywords()
17451746
elif request == 'symbols': self.listsymbols()

Lib/test/test_pydoc.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,12 @@ def test_not_here(self):
254254
self.assertEqual(expected, result,
255255
"documentation for missing module found")
256256

257+
def test_input_strip(self):
258+
missing_module = " test.i_am_not_here "
259+
result = str(run_pydoc(missing_module), 'ascii')
260+
expected = missing_pattern % missing_module.strip()
261+
self.assertEqual(expected, result)
262+
257263

258264
class TestDescriptions(unittest.TestCase):
259265

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ Core and Builtins
3434
Library
3535
-------
3636

37+
- Issue #6121: pydoc now ignores leading and trailing spaces in the
38+
argument to the 'help' function.
39+
3740
- Issue #6118: urllib.parse.quote_plus ignored the encoding and errors
3841
arguments for strings with a space in them.
3942

0 commit comments

Comments
 (0)