-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Fix --diff output when encountering EOF #1328
Conversation
As mentioned, |
fca7df5
to
30c1a54
Compare
Fixed the test which was also exhibiting this bug (and thus failing after the fix). |
`split("\n")` includes a final empty element `""` if the final line ends with `\n` (as it should for POSIX-compliant text files), which then became an extra `"\n"`. `splitlines()` solves that, but there's a caveat, as it will split on other types of line breaks too (like `\r`), which may not be desired. Fixes psf#526.
30c1a54
to
6839589
Compare
Note that I didn't touch other uses of
|
Thanks! The other cases look harmless (two are in test data and one always ignores an empty line at the end). |
`split("\n")` includes a final empty element `""` if the final line ends with `\n` (as it should for POSIX-compliant text files), which then became an extra `"\n"`. `splitlines()` solves that, but there's a caveat, as it will split on other types of line breaks too (like `\r`), which may not be desired. Fixes #526.
Until psf/black#1328 makes it in a stable release, we have to use the latest from Git. Apply new style fixes done by latest black.
Until psf/black#1328 makes it in a stable release, we have to use the latest from Git. Apply new style fixes done by latest black.
split("\n")
includes a final empty element""
if the final lineends with
\n
(as it should for POSIX-compliant text files), whichthen became an extra
"\n"
.splitlines()
solves that, but there's a caveat, as it will spliton other types of line breaks too (like
\r
), which may not bedesired.
Fixes #526.
Thanks to @benkuhn for the well-debugged issue.