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

Black crashes with a single # fmt: off before a dict's closing bracket #3458

Closed
yilei opened this issue Dec 19, 2022 · 0 comments · Fixed by #4363
Closed

Black crashes with a single # fmt: off before a dict's closing bracket #3458

yilei opened this issue Dec 19, 2022 · 0 comments · Fixed by #4363
Labels
C: crash Black is crashing F: fmtoff fmt: off implementation T: bug Something isn't working

Comments

@yilei
Copy link
Contributor

yilei commented Dec 19, 2022

Describe the bug

To Reproduce

For example, take this code:

dependencies = {
    a: b,
    # fmt: off
}

And run it with these arguments:

$ black t.py

The resulting error is:

error: cannot format /Users/yileiyang/Downloads/t.py: Unable to match a closing bracket to the following opening bracket:

Oh no! 💥 💔 💥
1 file would fail to reformat.

Expected behavior

This is not a valid use of # fmt: off, but Black shouldn't crash either.

Environment

  • Black's version: this crash existed since v22.1.0 in the stable style

Additional context

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: crash Black is crashing F: fmtoff fmt: off implementation T: bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants