Skip to content
Closed
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions Lib/ast.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,8 @@ def _format(node, level=0):
not show_empty
and (value is None or value == [])
# Special cases:
# `Constant(value=None)` and `MatchSingleton(value=None)`
and not isinstance(node, (Constant, MatchSingleton))
# `Constant(value=None)` and `MatchSingleton(value=None)` and `MatchStar(name=None)`
and not isinstance(node, (Constant, MatchSingleton, MatchStar))
):
args_buffer.append(repr(value))
continue
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Fixed :class:`ast.MatchStar` to remove incorrect class-level default value
for the ``name`` field.
Fixed :func:`ast.dump` to show the ``name`` field of
:class:`ast.MatchStar` when the value is ``None``.
2 changes: 1 addition & 1 deletion Parser/Python.asdl
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ module Python
| MatchMapping(expr* keys, pattern* patterns, identifier? rest)
| MatchClass(expr cls, pattern* patterns, identifier* kwd_attrs, pattern* kwd_patterns)

| MatchStar(identifier? name)
| MatchStar(identifier name)
-- The optional "rest" MatchMapping parameter handles capturing extra mapping keys

| MatchAs(pattern? pattern, identifier? name)
Expand Down
24 changes: 11 additions & 13 deletions Python/Python-ast.c

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading