https://github.com/python/cpython/commit/8f135ce22e487f065fcf0282628bafc9e86fdb6d
commit: 8f135ce22e487f065fcf0282628bafc9e86fdb6d
branch: 3.14
author: sobolevn <[email protected]>
committer: sobolevn <[email protected]>
date: 2026-06-24T22:14:40Z
summary:

[3.14] gh-105895: Add `match` and `case` doc to `help()` (GH-152113) (#152129)

(cherry picked from commit 1d55b3778c1c31549c5f914fcc451db4a3dcc501)

Co-authored-by: dzherb <[email protected]>
Co-authored-by: Stan Ulbrych <[email protected]>

files:
A Misc/NEWS.d/next/Library/2026-06-24-22-16-35.gh-issue-105895.hRkuEw.rst
M Doc/tools/extensions/pydoc_topics.py
M Lib/pydoc.py
M Lib/test/test_pydoc/test_pydoc.py

diff --git a/Doc/tools/extensions/pydoc_topics.py 
b/Doc/tools/extensions/pydoc_topics.py
index a65d77433b255bc..84c29f9e782af19 100644
--- a/Doc/tools/extensions/pydoc_topics.py
+++ b/Doc/tools/extensions/pydoc_topics.py
@@ -69,6 +69,7 @@
     "integers",
     "lambda",
     "lists",
+    "match",
     "naming",
     "nonlocal",
     "numbers",
diff --git a/Lib/pydoc.py b/Lib/pydoc.py
index 1f8a6ef3d7c998f..091f8af01b2b422 100644
--- a/Lib/pydoc.py
+++ b/Lib/pydoc.py
@@ -1876,6 +1876,7 @@ class Helper:
         'async': ('async', ''),
         'await': ('await', ''),
         'break': ('break', 'while for'),
+        'case': 'match',
         'class': ('class', 'CLASSES SPECIALMETHODS'),
         'continue': ('continue', 'while for'),
         'def': ('function', ''),
@@ -1887,11 +1888,12 @@ class Helper:
         'for': ('for', 'break continue while'),
         'from': 'import',
         'global': ('global', 'nonlocal NAMESPACES'),
-        'if': ('if', 'TRUTHVALUE'),
+        'if': ('if', 'TRUTHVALUE match'),
         'import': ('import', 'MODULES'),
         'in': ('in', 'SEQUENCEMETHODS'),
         'is': 'COMPARISON',
         'lambda': ('lambda', 'FUNCTIONS'),
+        'match': ('match', 'if'),
         'nonlocal': ('nonlocal', 'global NAMESPACES'),
         'not': 'BOOLEAN',
         'or': 'BOOLEAN',
diff --git a/Lib/test/test_pydoc/test_pydoc.py 
b/Lib/test/test_pydoc/test_pydoc.py
index 8ea7f267e693e86..f7c1e72b1454e4c 100644
--- a/Lib/test/test_pydoc/test_pydoc.py
+++ b/Lib/test/test_pydoc/test_pydoc.py
@@ -2211,7 +2211,7 @@ def mock_getline(prompt):
 
     def test_keywords(self):
         self.assertEqual(sorted(pydoc.Helper.keywords),
-                         sorted(keyword.kwlist))
+                         sorted(keyword.kwlist + ['case', 'match']))
 
     def test_interact_empty_line_continues(self):
         # gh-138568: test pressing Enter without input should continue in help 
session
diff --git 
a/Misc/NEWS.d/next/Library/2026-06-24-22-16-35.gh-issue-105895.hRkuEw.rst 
b/Misc/NEWS.d/next/Library/2026-06-24-22-16-35.gh-issue-105895.hRkuEw.rst
new file mode 100644
index 000000000000000..c69e6fa7d14f4dc
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2026-06-24-22-16-35.gh-issue-105895.hRkuEw.rst
@@ -0,0 +1,2 @@
+Add :keyword:`match` and :keyword:`case` to the list of supported topics by
+:func:`help`.

_______________________________________________
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]

Reply via email to