Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 147d075

Browse files
authored
black/parser: support as-exprs within call args (psf#2608)
1 parent eb9d039 commit 147d075

3 files changed

Lines changed: 11 additions & 0 deletions

File tree

src/blib2to3/Grammar.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ arglist: argument (',' argument)* [',']
186186
# that precede iterable unpackings are blocked; etc.
187187
argument: ( test [comp_for] |
188188
test ':=' test |
189+
test 'as' test |
189190
test '=' test |
190191
'**' test |
191192
'*' test )
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
match something:
2+
case [a as b]:
3+
print(b)
4+
case [a as b, c, d, e as f]:
5+
print(f)
6+
case Point(a as b):
7+
print(b)
8+
case Point(int() as x, int() as y):
9+
print(x, y)

tests/test_format.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@
7373
PY310_CASES = [
7474
"pattern_matching_simple",
7575
"pattern_matching_complex",
76+
"pattern_matching_extras",
7677
"parenthesized_context_managers",
7778
]
7879

0 commit comments

Comments
 (0)