-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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 docstring end follows double quote #1452
Labels
Comments
Git bisect points to a4c11a7 as the first bad commit, from PR #1053, "Re-indent the contents of docstrings". PR #1417 fixed some other docstring things (#1415) but not this case. Here's a smaller failing case: def containing_quotes():
"""No quotes here
"quotes here" """
pass Or: def containing_quotes():
"""No quotes here
quote here" """
pass |
This was referenced May 22, 2020
alexmv
added a commit
to alexmv/black
that referenced
this issue
May 22, 2020
0;95;0c The PEP 257 algorithm used in psf#1053 results in trimming trailing whitespace in docstrings -- see psf#1415 and fixes in psf#1417. Removing trailing whitespace may result in four quotes in a row: def foo(): """"Some content and more "here" """ pass When closing the docstring, escape any trailing quote characters that it matches, if they are not already escaped. Fixes psf#1452.
alexmv
added a commit
to alexmv/black
that referenced
this issue
May 22, 2020
The PEP 257 algorithm used in psf#1053 results in trimming trailing whitespace in docstrings -- see psf#1415 and fixes in psf#1417. Removing trailing whitespace may result in four quotes in a row: def foo(): """"Some content and more "here" """ pass When closing the docstring, escape any trailing quote characters that it matches, if they are not already escaped. Fixes psf#1452.
alexmv
added a commit
to alexmv/black
that referenced
this issue
Jul 31, 2020
The PEP 257 algorithm used in psf#1053 results in trimming trailing whitespace in docstrings -- see psf#1415. Adjust the algorithm to preserve leading and trailing whitespace; this reverts the changes in psf#1417. This diverges from PEP 257, but better retains the contents of the docstring. Fixes psf#1452 because we no longer can end up with four trailing quotes.
Fixed by #1623. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Describe the bug A clear and concise description of what the bug is.
To Reproduce Steps to reproduce the behavior:
(Simplified from https://github.com/jazzband/prettytable/blob/master/prettytable.py)
black 1.py
Expected behavior A clear and concise description of what you expected to happen.
File was formatted.
Environment (please complete the following information):
Does this bug also happen on master? To answer this, you have two options:
Yes with
master
. No with latest 19.10b0 release, which does not change the file.Additional context Add any other context about the problem here.
It's fine with single quotes instead in
"t", "m", or "b"
, or with a newline after"b"
.The text was updated successfully, but these errors were encountered: