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

Make sure Black doesn't crash when fmt:off is used before a closing paren #4363

Merged
merged 3 commits into from
May 16, 2024

Conversation

yilei
Copy link
Contributor

@yilei yilei commented May 15, 2024

Description

When a # fmt: off is used before a closing paren, it's invalid as Black demands that the # fmt: on/off pairs must be on the same level of indentation and in the same block. So this PR choses to ignore it. Previously it would crash as it ends up with one extra closing paren.

(Also refactored the convert_one_fmt_off_pair function a little bit.)

Checklist - did you ...

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

Copy link

diff-shades reports zero changes comparing this PR (a732cc2) to main (b9c6323).


What is this? | Workflow run | diff-shades documentation

@JelleZijlstra
Copy link
Collaborator

Thank you!

@JelleZijlstra JelleZijlstra merged commit 9c1fd46 into psf:main May 16, 2024
46 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants