From cf94dddff520bf9db72c613ee9665d5a4de17777 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Delfino?= Date: Thu, 5 Nov 2026 14:43:29 -0300 Subject: [PATCH] gh-161414: Remove the backquote from the `pydoc` symbols (GH-161416) (cherry picked from commit d003448092a043f7bd4b604b210bd682910de6d6) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Andrés Delfino Co-authored-by: sobolevn Co-authored-by: Stan Ulbrych --- Lib/pydoc.py | 1 - Lib/test/test_pydoc/test_pydoc.py | 8 ++++++++ .../2026-11-05-11-59-58.gh-issue-161414.Xnxe8A.rst | 2 ++ 3 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 Misc/NEWS.d/next/Library/2026-11-05-11-59-58.gh-issue-161414.Xnxe8A.rst diff --git a/Lib/pydoc.py b/Lib/pydoc.py index b5344d76ded294..24d1772e320f1e 100644 --- a/Lib/pydoc.py +++ b/Lib/pydoc.py @@ -1886,7 +1886,6 @@ class Helper: ':=': 'ASSIGNMENTEXPRESSIONS', '_': 'PRIVATENAMES', '__': 'PRIVATENAMES SPECIALMETHODS', - '`': 'BACKQUOTES', '(': 'TUPLES FUNCTIONS CALLS', ')': 'TUPLES FUNCTIONS CALLS', '[': 'LISTS SUBSCRIPTS SLICINGS', diff --git a/Lib/test/test_pydoc/test_pydoc.py b/Lib/test/test_pydoc/test_pydoc.py index 9cb7f662387f6f..3f39fb64afbd11 100644 --- a/Lib/test/test_pydoc/test_pydoc.py +++ b/Lib/test/test_pydoc/test_pydoc.py @@ -2200,6 +2200,14 @@ def test_keywords(self): self.assertEqual(sorted(pydoc.Helper.keywords), sorted(keyword.kwlist + ['case', 'match', 'lazy'])) + def test_symbols(self): + # gh-161414 + for symbol in pydoc.Helper.symbols: + with self.subTest(symbol=symbol): + buf = StringIO() + pydoc.Helper(output=buf).showsymbol(symbol) + self.assertNotIn('no documentation found', buf.getvalue()) + def test_interact_empty_line_continues(self): # gh-138568: test pressing Enter without input should continue in help session self.assertEqual( diff --git a/Misc/NEWS.d/next/Library/2026-11-05-11-59-58.gh-issue-161414.Xnxe8A.rst b/Misc/NEWS.d/next/Library/2026-11-05-11-59-58.gh-issue-161414.Xnxe8A.rst new file mode 100644 index 00000000000000..7536c5c25a13f5 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2026-11-05-11-59-58.gh-issue-161414.Xnxe8A.rst @@ -0,0 +1,2 @@ +Remove the backquote from the symbols listed by :func:`help`, asking for help on it reported that no +documentation was found.