fix crash in preview mode with --line-length=1 (#4086)
This commit is contained in:
parent
3416b2c82d
commit
50d5756e8e
@ -17,6 +17,7 @@
|
||||
- Standalone form feed characters at the module level are no longer removed (#4021)
|
||||
- Additional cases of immediately nested tuples, lists, and dictionaries are now
|
||||
indented less (#4012)
|
||||
- Fix crash in preview mode when using a short `--line-length` (#4086)
|
||||
|
||||
### Configuration
|
||||
|
||||
|
@ -744,7 +744,7 @@ def left_hand_split(
|
||||
if leaf.type in OPENING_BRACKETS:
|
||||
matching_bracket = leaf
|
||||
current_leaves = body_leaves
|
||||
if not matching_bracket:
|
||||
if not matching_bracket or not tail_leaves:
|
||||
raise CannotSplit("No brackets found")
|
||||
|
||||
head = bracket_split_build_line(
|
||||
|
@ -0,0 +1,9 @@
|
||||
# flags: --preview --minimum-version=3.10 --line-length=1
|
||||
|
||||
def foo() -> tuple[int, int,]:
|
||||
...
|
||||
# output
|
||||
def foo() -> tuple[
|
||||
int,
|
||||
int,
|
||||
]: ...
|
Loading…
Reference in New Issue
Block a user