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

# fmt skip internal error fix (space between # and f) #2682

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,7 @@ and the first release covered by our new

### _Black_

- Add handling for internal error regarding #fmt: skip (#2682)
- Fix determination of f-string expression spans (#2654)
- Fix bad formatting of error messages about EOF in multi-line statements (#2343)
- Functions and classes in blocks now have more consistent surrounding spacing (#2472)
Expand Down
3 changes: 3 additions & 0 deletions src/black/comments.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@ def make_comment(content: str, *, preview: bool) -> str:
if not content:
return "#"

if content == "#fmt: skip":
return "# fmt: skip"

if content[0] == "#":
content = content[1:]
NON_BREAKING_SPACE = " "
Expand Down
3 changes: 3 additions & 0 deletions tests/data/fmtskip7.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
a, b = 1, 2
c = 6 #fmt: skip
d = 5