fix: additional newline added to docstring when the previous line length is l#5151
Draft
YousafZahid1 wants to merge 2 commits into
Draft
fix: additional newline added to docstring when the previous line length is l#5151YousafZahid1 wants to merge 2 commits into
YousafZahid1 wants to merge 2 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #4180
What this PR fixes
Issue: additional newline added to docstring when the previous line length is less than the line length limit minus 1
Issue description:
before
after
playground
https://black.vercel.app/?version=stable&state=_Td6WFoAAATm1rRGAgAhARYAAAB0L-Wj4ADOAFldAD2IimZxl1N_Wk8JgdvQ8tSq0OhVZoEptWlmdC__omMouK3ooOylgkoYGVUTpRL_A_26nUoIFOzsQcUzX_N1N5WllahS-T5qlleGaKsl1U08Mc7wSjEUdEm8AAAAADdi2bh7NF1_AAF1zwEAAADAUENLscRn-wIAAAAABFla
Changes
3 file(s) modified (+70 / -1 lines):
src/black/trans.pytests/test_strings.pytests/test_trans.pyApproach
lines_with_leading_tabs_expandedfunction — it may cause unrelated errors like PHASE=setup, ERROR: Invalid requirement: '_black_version' (The StringMerger class in src/black/trans.py caused failure by incorrectly handling newlines in docstrings.)Test status
Automated tests did not fully pass. This patch addresses the root cause
but may need additional work. Please review the diff and run tests locally.
Opened automatically by Gray — please review before merging.
Draft — promote to ready when satisfied.