You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If a condition statement is wrapped in # fmt: off/# fmt: on, Black crashes with a parse error on the subsequent line.
The crash only occurs if the # fmt: off comment is indented the same as the wrapped condition.
To Reproduce
The following minimal code breaks parsing with Black 22.10 and later:
Describe the bug
If a condition statement is wrapped in
# fmt: off
/# fmt: on
, Black crashes with a parse error on the subsequent line.The crash only occurs if the
# fmt: off
comment is indented the same as the wrapped condition.To Reproduce
The following minimal code breaks parsing with Black 22.10 and later:
And run it with these arguments:
The resulting error is:
Expected behavior
Black can parse this valid Python snippet regardless of how the
# fmt: off
comment is indented.This is the case for Black 22.6 and older.
Environment
Additional context
Interestingly, Black doesn't crash if the fmt-off comment is indented one more level.
This is parsed fine:
However, the instruction is also ignored, ie. the
# fmt: off
command isn't recognised as such.The text was updated successfully, but these errors were encountered: