Skip to content
Merged
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
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

<!-- Changes that affect Black's stable style -->
- 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

Expand Down
1 change: 1 addition & 0 deletions src/black/linegen.py
Original file line number Diff line number Diff line change
Expand Up @@ -1649,6 +1649,7 @@ def maybe_make_parens_invisible_in_atom(
syms.except_clause,
syms.funcdef,
syms.with_stmt,
syms.testlist_gexp,
syms.tname,
# these ones aren't useful to end users, but they do please fuzzers
syms.for_stmt,
Expand Down
5 changes: 5 additions & 0 deletions tests/data/cases/pep_572_py310.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,8 @@
f((a := b + c for c in range(10)), x)
f(y=(a := b + c for c in range(10)))
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