Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix crash in preview mode with --line-length=1 #4086

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/black/linegen.py
Expand Up @@ -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(
Expand Down
@@ -0,0 +1,9 @@
# flags: --preview --minimum-version=3.10 --line-length=1

def foo() -> tuple[int, int,]:
...
# output
def foo() -> tuple[
int,
int,
]: ...