https://github.com/python/cpython/commit/02843599bdcf07d6864024078fdbc9a338ee639e commit: 02843599bdcf07d6864024078fdbc9a338ee639e branch: 3.15 author: Miss Islington (bot) <[email protected]> committer: sobolevn <[email protected]> date: 2026-11-07T09:44:42Z summary:
[3.15] gh-161415: Remove nonexistent related help topics in `pydoc` (GH-161417) (#161541) gh-161415: Remove nonexistent related help topics in `pydoc` (GH-161417) The TYPES topic listed FILES, which was removed from Helper.topics in Python 3.4, and the UNICODE topic listed unicode, the Python 2 built-in type. help() finds no entry for either of them. (cherry picked from commit 301643a9e331679d50fba596a32d3119f99dc1bf) Co-authored-by: Andrés Delfino <[email protected]> files: A Misc/NEWS.d/next/Library/2026-11-05-12-00-24.gh-issue-161415.NJhrAR.rst M Lib/pydoc.py M Lib/test/test_pydoc/test_pydoc.py diff --git a/Lib/pydoc.py b/Lib/pydoc.py index 24d1772e320f1e4..85da0ac139bacb8 100644 --- a/Lib/pydoc.py +++ b/Lib/pydoc.py @@ -1901,12 +1901,12 @@ class Helper: topics = { 'TYPES': ('types', 'STRINGS UNICODE NUMBERS SEQUENCES MAPPINGS ' - 'FUNCTIONS CLASSES MODULES FILES inspect'), + 'FUNCTIONS CLASSES MODULES inspect'), 'STRINGS': ('strings', 'str UNICODE SEQUENCES STRINGMETHODS ' 'FORMATTING TYPES'), 'STRINGMETHODS': ('string-methods', 'STRINGS FORMATTING'), 'FORMATTING': ('formatstrings', 'OPERATORS'), - 'UNICODE': ('strings', 'encodings unicode SEQUENCES STRINGMETHODS ' + 'UNICODE': ('strings', 'encodings SEQUENCES STRINGMETHODS ' 'FORMATTING TYPES'), 'NUMBERS': ('numbers', 'INTEGER FLOAT COMPLEX TYPES'), 'INTEGER': ('integers', 'int range'), diff --git a/Lib/test/test_pydoc/test_pydoc.py b/Lib/test/test_pydoc/test_pydoc.py index 3f39fb64afbd11e..095289cb9b666f7 100644 --- a/Lib/test/test_pydoc/test_pydoc.py +++ b/Lib/test/test_pydoc/test_pydoc.py @@ -2200,6 +2200,19 @@ def test_keywords(self): self.assertEqual(sorted(pydoc.Helper.keywords), sorted(keyword.kwlist + ['case', 'match', 'lazy'])) + def test_related_topics(self): + # Every related help topic and alias must be something help() can + # document. + for name, target in (*pydoc.Helper.topics.items(), + *pydoc.Helper.keywords.items()): + if isinstance(target, str): + target = ('', target) + for xref in target[1].split(): + with self.subTest(topic=name, xref=xref): + buf = StringIO() + pydoc.Helper(output=buf).help(xref) + self.assertNotIn('No help entry found', buf.getvalue()) + def test_symbols(self): # gh-161414 for symbol in pydoc.Helper.symbols: diff --git a/Misc/NEWS.d/next/Library/2026-11-05-12-00-24.gh-issue-161415.NJhrAR.rst b/Misc/NEWS.d/next/Library/2026-11-05-12-00-24.gh-issue-161415.NJhrAR.rst new file mode 100644 index 000000000000000..22cc4665c253dde --- /dev/null +++ b/Misc/NEWS.d/next/Library/2026-11-05-12-00-24.gh-issue-161415.NJhrAR.rst @@ -0,0 +1,3 @@ +Remove ``FILES`` and ``unicode`` from the related help topics listed by +:func:`help` for the ``TYPES`` and ``UNICODE`` topics. Neither exists in +Python 3, so asking for help on them failed. _______________________________________________ Python-checkins mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3//lists/python-checkins.python.org Member address: [email protected]
