diff -r fd1f47a57ba2 Lib/pydoc.py --- a/Lib/pydoc.py Thu Apr 28 00:48:46 2011 +0300 +++ b/Lib/pydoc.py Thu Apr 28 05:15:31 2011 +0300 @@ -1538,6 +1538,9 @@ # in Doc/ and copying the output file into the Lib/ directory. keywords = { + 'False': '', + 'None': '', + 'True': '', 'and': 'BOOLEAN', 'as': 'with', 'assert': ('assert', ''), @@ -1558,6 +1561,7 @@ 'in': ('in', 'SEQUENCEMETHODS'), 'is': 'COMPARISON', 'lambda': ('lambda', 'FUNCTIONS'), + 'nonlocal': ('nonlocal', 'NAMESPACES'), 'not': 'BOOLEAN', 'or': 'BOOLEAN', 'pass': ('pass', ''), @@ -1752,6 +1756,9 @@ elif request[:8] == 'modules ': self.listmodules(request.split()[1]) elif request in self.symbols: self.showsymbol(request) + elif request in ['True', 'False', 'None']: + # special case these keywords since they are objects too + doc(eval(request), 'Help on %s:') elif request in self.keywords: self.showtopic(request) elif request in self.topics: self.showtopic(request) elif request: doc(request, 'Help on %s:') diff -r fd1f47a57ba2 Lib/test/test_pydoc.py --- a/Lib/test/test_pydoc.py Thu Apr 28 00:48:46 2011 +0300 +++ b/Lib/test/test_pydoc.py Thu Apr 28 05:15:31 2011 +0300 @@ -6,6 +6,7 @@ import re import pydoc import inspect +import keyword import unittest import test.support import xml.etree @@ -344,8 +345,13 @@ self.assertTrue(expected in pydoc.render_doc(c)) +class TestHelper(unittest.TestCase): + def test_keywords(self): + self.assertEqual(sorted(pydoc.Helper.keywords), + sorted(keyword.kwlist)) + def test_main(): - test.support.run_unittest(PyDocDocTest, TestDescriptions) + test.support.run_unittest(PyDocDocTest, TestDescriptions, TestHelper) if __name__ == "__main__": test_main()