Fix parsing of walrus operator in complex with statements (#4630)
This commit is contained in:
parent
dd278cb316
commit
6144c46c6a
@ -10,6 +10,8 @@
|
|||||||
|
|
||||||
<!-- Changes that affect Black's stable style -->
|
<!-- Changes that affect Black's stable style -->
|
||||||
- Fix crash while formatting a long `del` statement containing tuples (#4628)
|
- Fix crash while formatting a long `del` statement containing tuples (#4628)
|
||||||
|
- Fix crash while formatting expressions using the walrus operator in complex
|
||||||
|
`with` statements (#4630)
|
||||||
|
|
||||||
### Preview style
|
### Preview style
|
||||||
|
|
||||||
|
@ -1649,6 +1649,7 @@ def maybe_make_parens_invisible_in_atom(
|
|||||||
syms.except_clause,
|
syms.except_clause,
|
||||||
syms.funcdef,
|
syms.funcdef,
|
||||||
syms.with_stmt,
|
syms.with_stmt,
|
||||||
|
syms.testlist_gexp,
|
||||||
syms.tname,
|
syms.tname,
|
||||||
# these ones aren't useful to end users, but they do please fuzzers
|
# these ones aren't useful to end users, but they do please fuzzers
|
||||||
syms.for_stmt,
|
syms.for_stmt,
|
||||||
|
@ -14,3 +14,8 @@
|
|||||||
f((a := b + c for c in range(10)), x)
|
f((a := b + c for c in range(10)), x)
|
||||||
f(y=(a := b + c for c in range(10)))
|
f(y=(a := b + c for c in range(10)))
|
||||||
f(x, (a := b + c for c in range(10)), y=z, **q)
|
f(x, (a := b + c for c in range(10)), y=z, **q)
|
||||||
|
|
||||||
|
|
||||||
|
# Don't remove parens when assignment expr is one of the exprs in a with statement
|
||||||
|
with x, (a := b):
|
||||||
|
pass
|
||||||
|
Loading…
Reference in New Issue
Block a user