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 on assert and parenthesized % format (fixes #1597, fixes #1605) #1681

Conversation

bbugyi200
Copy link
Contributor

@bbugyi200 bbugyi200 commented Sep 5, 2020

Fixes #1597. Fixes #1605.

try:
append_leaves(new_line, line, LL[: string_idx - 1])
except BracketMatchError as e:
# HACK: I believe there is currently a bug somewhere in
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is unfortunate, but it's better than a crash, and the formatting in the newly added test cases looks reasonable.

Copy link
Contributor Author

@bbugyi200 bbugyi200 Sep 6, 2020

Choose a reason for hiding this comment

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

On second thought, I don't think this will do. The append_leaves() function modifies the Node structure of the leaves and so must be atomic. I will have to come up with a different solution.

Copy link
Contributor Author

@bbugyi200 bbugyi200 Sep 6, 2020

Choose a reason for hiding this comment

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

Ok. This is fixed. The corrected version of this fix, though still not ideal, has the benefit of stripping the parens as is consistent with blacks style after #1132.

@bbugyi200 bbugyi200 marked this pull request as draft September 6, 2020 14:40
@bbugyi200 bbugyi200 force-pushed the 1597-fix-crash-on-assert-and-old-style-fmting branch from ccc7723 to d55a5f4 Compare September 6, 2020 15:38
@bbugyi200 bbugyi200 marked this pull request as ready for review September 6, 2020 15:39
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.

error: cannot format Tests/test_file_libtiff.py: (-1, 8) Crash on assert and parenthesized % format
2 participants