https://github.com/python/cpython/commit/301643a9e331679d50fba596a32d3119f99dc1bf
commit: 301643a9e331679d50fba596a32d3119f99dc1bf
branch: main
author: Andrés Delfino <[email protected]>
committer: sobolevn <[email protected]>
date: 2026-11-07T08:28:27Z
summary:
gh-161415: Remove nonexistent related help topics in `pydoc` (#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.
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 a586d35866b038f..e1efe8fc0a1b631 100644
--- a/Lib/pydoc.py
+++ b/Lib/pydoc.py
@@ -2028,12 +2028,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 a63530c29058275..552b0c7d0759498 100644
--- a/Lib/test/test_pydoc/test_pydoc.py
+++ b/Lib/test/test_pydoc/test_pydoc.py
@@ -2294,6 +2294,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]