-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Description
Describe the bug
To Reproduce
For example, take this code:
[
(1, 2),
# # fmt: off
# (3,
# 4),
# # fmt: on
(5, 6),
]And run it with these arguments:
$ black file.pyThe resulting error is:
error: cannot format file.py: INTERNAL ERROR: Black 25.11.0 on Python (CPython) 3.11.13 produced different code on the second pass of the formatter. Please report a bug on https://github.com/psf/black/issues. This diff might be helpful: /tmp/blk_wtxhgk34.log
Oh no! ๐ฅ ๐ ๐ฅ
1 file failed to reformat.
The error is most likely caused by the inclusion of a set of commented lines that include # # fmt: off and # # fmt: on. Removing one or both of these lines does not cause the error.
Expected behavior
I would expect no errors and in fact, this does not occur in previous versions. Is this new behaviour expected?
Environment
- Black's version: 25.11.0
- OS and Python version: Linux/Ubuntu 24.04.2 LTS/Python 3.11.13