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

Black runs into internal error when docstring ends with EM QUAD #2120

Closed
Jackenmen opened this issue Apr 20, 2021 · 1 comment · Fixed by #2147
Closed

Black runs into internal error when docstring ends with EM QUAD #2120

Jackenmen opened this issue Apr 20, 2021 · 1 comment · Fixed by #2147
Labels
T: bug Something isn't working

Comments

@Jackenmen
Copy link
Contributor

Describe the bug

To Reproduce

  1. Copy this code (it needs to be copied as it contains \u2001 character at the end of first docstring line):
def foo():
    """A special character: ` 
`
    """
  1. Run Black on it with the default configuration.
  2. See error:
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_o610r37n.log

--- src
+++ dst
@@ -16,11 +16,11 @@
       body=
         Expr(
           value=
             Constant(
               value=
-                'A special character: `\u2001\n`',  # str
+                'A special character: `\n`',  # str
             )  # /Constant
         )  # /Expr
       decorator_list=
       name=
         'foo',  # str

Expected behavior
No error

Environment:

  • Version: both stable and master
  • OS and Python version: Windows/Python 3.8 (as well as whatever is running on Black Playground)

Does this bug also happen on master? Yes

Additional context
None

@Jackenmen Jackenmen added the T: bug Something isn't working label Apr 20, 2021
@JelleZijlstra
Copy link
Collaborator

This is https://www.compart.com/en/unicode/U+2001, a whitespace character, so presumably we're stripping it as trailing whitespace in the docstring processing code, but not accepting the change in the safety check. Shouldn't be hard to fix.

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.

2 participants