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

Crash on docstring with misindented character #1585

Closed
JelleZijlstra opened this issue Aug 11, 2020 · 2 comments
Closed

Crash on docstring with misindented character #1585

JelleZijlstra opened this issue Aug 11, 2020 · 2 comments
Labels
C: invalid code Black destroyed a valid Python file T: bug Something isn't working

Comments

@JelleZijlstra
Copy link
Collaborator

$ cat web/lib/webhelpers/html/blackbug.py 
def checkbox():
    """Create a check box.  Pass the empty string ("") to suppress the
    ID attribute entirely.

d
    The following HTML attributes may be set by keyword argument:
    """
$ ~/repos/black/.venv/bin/black  web/lib/webhelpers/html/blackbug.py 
error: cannot format web/lib/webhelpers/html/blackbug.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: /tmp/blk_azbg7n69.log
Oh no! 💥 💔 💥
1 file failed to reformat.
$ ~/repos/black/.venv/bin/black --version
black, version 19.10b1.dev134+gb59a524.d20200811
$ cat /tmp/blk_azbg7n69.log
--- src
+++ dst
@@ -15,11 +15,11 @@
       body=
         Expr(
           value=
             Constant(
               value=
-                'Create a check box.  Pass the empty string ("") to suppress the\n ID attribute entirely.\n\nd\n The following HTML attributes may be set by keyword argument:',  # str
+                'Create a check box.  Pass the empty string ("") to suppress the\n ID attribute entirely.\n\n d\n The following HTML attributes may be set by keyword argument:',  # str
             )  # /Constant
         )  # /Expr
       decorator_list=
       name=
         'checkbox',  # str

I don't know why that random "d" was there but it shouldn't crash Black.

@JelleZijlstra JelleZijlstra added T: bug Something isn't working C: invalid code Black destroyed a valid Python file labels Aug 11, 2020
@hugovk
Copy link
Contributor

hugovk commented Aug 12, 2020

Doesn't crash with last release 19.10b.

git bisect points to a4c11a7 from PR #1053: "Re-indent the contents of docstrings".

@JelleZijlstra
Copy link
Collaborator Author

This is fixed on master, maybe by #1593.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: invalid code Black destroyed a valid Python file T: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants