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

INTERNAL ERROR when there is an non breaking space in a docstring #1762

Closed
Pierre-Sassoulas opened this issue Oct 13, 2020 · 1 comment
Closed
Labels
T: bug Something isn't working

Comments

@Pierre-Sassoulas
Copy link
Contributor

Steps to reproduce the behavior:

  1. With the following code:
def plot():
    """ adds a variable to the plot according to it's conf

    >   variables : 
    >       foo:
    >           y: variable(bar)
    >       baz:
    >           color: red

    """

Notice that there is a non breaking space just after variables :.

  1. Run Black on it with no argument
  2. The following error happens:
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: /tmp/blk_xn6q3h3t.log

--- src
+++ dst
@@ -16,11 +16,11 @@
       body=
         Expr(
           value=
             Constant(
               value=
-                "adds a variable to the plot according to it's conf\n\n>   variables :\xa0\n>       foo:\n>           y: variable(bar)\n>       baz:\n>           color: red",  # str
+                "adds a variable to the plot according to it's conf\n\n>   variables :\n>       foo:\n>           y: variable(bar)\n>       baz:\n>           color: red",  # str
             )  # /Constant
         )  # /Expr
       decorator_list=
       name=
         'plot',  # str

The error disappear by removing the non breaking space.

Environment:

  • Version: black-20.8b1
  • OS and Python version: Linux/Python 3.8.5
  • The bug also happens on master
@Pierre-Sassoulas
Copy link
Contributor Author

Fixed in eaa337f see #2099 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T: bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant