Black: INTERNAL ERROR: Black produced code that is not equivalent to the source.

Created on 3 Sep 2020  ·  4Comments  ·  Source: psf/black

Describe the bug

A docstring is contained U+3000 ideographic space before new line code.

To Reproduce Steps to reproduce the behavior:

$ cat u3000.py
class Foo:
    """line1 
    line2
    """
$ cat /tmp/blk_doc2utq5.log
--- src
+++ dst
@@ -5,11 +5,11 @@
       body=
         Expr(
           value=
             Constant(
               value=
-                'line1\u3000\nline2',  # str
+                'line1\nline2',  # str
             )  # /Constant
         )  # /Expr
       decorator_list=
       keywords=
       name=

Environment (please complete the following information):

  • Version: 20.8b1
  • OS and Python version: Linux/Python 3.7.8

Does this bug also happen on master?

YES(20.8b2.dev12+g6b935a3)

bug

All 4 comments

Having a similar problem where Black 20.8b1, despite -S, strips \t from docstring, ending up with a different result.

While inspecting recent CI failure due to black formatting on https://github.com/ultrabug/py3status I got the same error from black.

black, version 20.8b1

error: cannot format /home/alexys/github/py3status/py3status/py3.py: INTERNAL ERROR: Black produced code that is not equivalent to the source.

With log file as attached:
blk_ie_wm_8t.log

Hope this helps, thanks!

@markgajdosik and @ultrabug, I think your issues are duplicates of #1635, whereas OP's looks like a unicode character being removed.

I am getting the same error.
Code contains very long docstrings, these are also in the log.

Log Attached:
blk_21_a5ozp.log

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Curly-Mo picture Curly-Mo  ·  3Comments

decibyte picture decibyte  ·  3Comments

feluxe picture feluxe  ·  3Comments

madig picture madig  ·  3Comments

brettcannon picture brettcannon  ·  3Comments