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

Conversation

jakkdl
Copy link
Contributor

@jakkdl jakkdl commented Dec 5, 2023

fixes #4062

crash happened when right_hand_split first split

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

to

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

and then left_hand_split followed up with splitting on the invisible LPAR around the return type in the first line to make it

def foo() ->
tuple[

This was due to insufficient logic in left_hand_split to abort in some weird cases, that it previously never got into because the code wasn't modified by right_hand_split beforehand - but that became a thing in #3916.

Description

Checklist - did you ...

  • Add an entry in CHANGES.md if necessary?
  • Add / update tests if necessary?
  • Add new / update outdated documentation?

Copy link
Collaborator

@JelleZijlstra JelleZijlstra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Could you add a changelog entry?

@jakkdl
Copy link
Contributor Author

jakkdl commented Dec 5, 2023

not sure how specific you wanted it, but done!

CHANGES.md Outdated Show resolved Hide resolved
@JelleZijlstra JelleZijlstra merged commit 50d5756 into psf:main Dec 5, 2023
45 of 46 checks passed
@jakkdl jakkdl deleted the fix_length1_respect_trailing_comma_in_return_type branch December 6, 2023 12:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Crash with preview style + line length 1
2 participants