]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] gh-105895: Add `match` and `case` doc to `help()` (GH-152113) (#152128)
authorsobolevn <mail@sobolevn.me>
Wed, 24 Jun 2026 22:05:05 +0000 (01:05 +0300)
committerGitHub <noreply@github.com>
Wed, 24 Jun 2026 22:05:05 +0000 (22:05 +0000)
(cherry picked from commit 1d55b3778c1c31549c5f914fcc451db4a3dcc501)

Co-authored-by: dzherb <zherbin.dima@yandex.ru>
Co-authored-by: Stan Ulbrych <stan@python.org>
Doc/tools/extensions/pydoc_topics.py
Lib/pydoc.py
Lib/test/test_pydoc/test_pydoc.py
Misc/NEWS.d/next/Library/2026-06-24-22-16-35.gh-issue-105895.hRkuEw.rst [new file with mode: 0644]

index a65d77433b255bc5b3a99d1669e6bf1fa4d3d57c..84c29f9e782af1987d6be6983eacecedf41f631f 100644 (file)
@@ -69,6 +69,7 @@ _PYDOC_TOPIC_LABELS: Sequence[str] = sorted({
     "integers",
     "lambda",
     "lists",
+    "match",
     "naming",
     "nonlocal",
     "numbers",
index d5b56f7ee08739e712b5c867bbe8d751ad21ce1f..18b37477060ad1340a8faf44c7df4f9d5c935431 100755 (executable)
@@ -1832,6 +1832,7 @@ class Helper:
         'async': ('async', ''),
         'await': ('await', ''),
         'break': ('break', 'while for'),
+        'case': 'match',
         'class': ('class', 'CLASSES SPECIALMETHODS'),
         'continue': ('continue', 'while for'),
         'def': ('function', ''),
@@ -1843,11 +1844,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',
index 581d2d15eb7f9afac317ee33fa0d50cce3c589a0..a6feb4497a47acc3d476cb14d35e11a4ecab8618 100644 (file)
@@ -2198,7 +2198,7 @@ class TestHelper(unittest.TestCase):
 
     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 (file)
index 0000000..c69e6fa
--- /dev/null
@@ -0,0 +1,2 @@
+Add :keyword:`match` and :keyword:`case` to the list of supported topics by
+:func:`help`.