Skip to content

Crash on docstring ending with newlines #1415

@JelleZijlstra

Description

@JelleZijlstra

Maybe a side effect of #1053?

$ cat common/qfuture/nltk2.py 
def word_tokenizer():
    """Returns NLTK's standard word tokenizer, but without a change that was applied in NLTK 3.0.3.

    """
    pass
$ black common/qfuture/nltk2.py
error: cannot format common/qfuture/nltk2.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_0awe_h_l.log
Oh no! 💥 💔 💥
1 file failed to reformat.
$ cat  /tmp/blk_0awe_h_l.log
--- src
+++ dst
@@ -15,11 +15,11 @@
       body=
         Expr(
           value=
             Constant(
               value=
-                "Returns NLTK's standard word tokenizer, but without a change that was applied in NLTK 3.0.3.\n\n ",  # str
+                "Returns NLTK's standard word tokenizer, but without a change that was applied in NLTK 3.0.3.",  # str
             )  # /Constant
         )  # /Expr
         Pass(
         )  # /Pass
       decorator_list=

Making this change is probably a good thing but we'll need to enhance the AST equivalence checker to let this through.

Metadata

Metadata

Assignees

Labels

T: bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions