When running black on method which doc string has tab in the middle of the string, black says:
error: cannot format black_example.py: INTERNAL ERROR: Black produced code that is not equivalent to the source.
To Reproduce Steps to reproduce the behavior:
foobarand is words. black black_example.pyerror: cannot format balck_example.py: INTERNAL ERROR: Black produced code that is not equivalent to the source. Please report a bug on https://github.com/psf/black/issues. This diff might be helpful: C:\Users\user\AppData\Local\Temp\blk_gf63oczm.log
In the log file I see:
--- src
+++ dst
@@ -24,11 +24,11 @@
body=
Expr(
value=
Constant(
value=
- 'Something\nfoobar\tis other', # str
+ 'Something\nfoobar is other', # str
) # /Constant
) # /Expr
Pass(
) # /Pass
decorator_list=
Expected behavior
Did expect black to format tab to spaces correctly.
Environment (please complete the following information):
Does this bug also happen on master?
Yes, tried with the online formatter.
Additional context
This looks like a regression, because error is not displayed in the 19,x release.
Thanks for the report, this looks like a duplicate of https://github.com/psf/black/issues/1601.
Looks pretty much related. Did not spot it when reporting this issue.
Thank you @hugovk, I also believe this is a duplicate of #1601. @aaltat perhaps +1 the original bug report?
Most helpful comment
Thank you @hugovk, I also believe this is a duplicate of #1601. @aaltat perhaps +1 the original bug report?