Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Link to existing rules in compound_stmts.rst (GH-149811)
In gh-138418, `!` was added to links to rules that don't exist in
the docs, in order to silence broken link warnings.
However, productionlist doesn't parse the `!`, which ends up in
the rendered documentation. (It's possible that gh-127835 broke
the `!` support.)

Replace the names with ones that appear in docs:

- `star_named_expression` in the grammar corresponds to
  `flexible_expression` in the docs
- `star_named_expressions` in the grammar corresponds to
  `flexible_expression_list` in the docs
- `named_expression` in the grammar corresponds to
  `assignment_expression` in the docs

Having two sets of names isn't great of course. Consolidating them
is tracked in (subissues of) gh-127833.
(cherry picked from commit c375292)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
  • Loading branch information
encukou authored and miss-islington committed May 14, 2026
commit 4200d3eb3a77b0e201dcf9cd71796708f43792f2
6 changes: 3 additions & 3 deletions Doc/reference/compound_stmts.rst
Original file line number Diff line number Diff line change
Expand Up @@ -618,8 +618,8 @@ The match statement is used for pattern matching. Syntax:

.. productionlist:: python-grammar
match_stmt: 'match' `subject_expr` ":" NEWLINE INDENT `case_block`+ DEDENT
subject_expr: `!star_named_expression` "," `!star_named_expressions`?
: | `!named_expression`
subject_expr: `flexible_expression` "," [`flexible_expression_list` [',']]
: | `assignment_expression`
case_block: 'case' `patterns` [`guard`] ":" `!block`

.. note::
Expand Down Expand Up @@ -709,7 +709,7 @@ Guards
.. index:: ! guard

.. productionlist:: python-grammar
guard: "if" `!named_expression`
guard: "if" `assignment_expression`

A ``guard`` (which is part of the ``case``) must succeed for code inside
the ``case`` block to execute. It takes the form: :keyword:`if` followed by an
Expand Down
Loading