All patches and comments are welcome. Please squash your changes to logical
commits before using git-format-patch and git-send-email to
patches@git.madduck.net.
If you'd read over the Git project's submission guidelines and adhered to them,
I'd be especially grateful.
Since the id of the old leaf may be
the key to comments, the new leaf
must adopt the old comments
<!-- Changes that affect Black's preview style -->
<!-- Changes that affect Black's preview style -->
+- Fix comments getting removed from inside parenthesized strings (#3909)
+
### Configuration
<!-- Changes to how Black can be configured -->
### Configuration
<!-- Changes to how Black can be configured -->
LL[lpar_or_rpar_idx].remove() # Remove lpar.
replace_child(LL[idx], string_leaf)
new_line.append(string_leaf)
LL[lpar_or_rpar_idx].remove() # Remove lpar.
replace_child(LL[idx], string_leaf)
new_line.append(string_leaf)
+ # replace comments
+ old_comments = new_line.comments.pop(id(LL[idx]), [])
+ new_line.comments.setdefault(id(string_leaf), []).extend(old_comments)
else:
LL[lpar_or_rpar_idx].remove() # This is a rpar.
else:
LL[lpar_or_rpar_idx].remove() # This is a rpar.
square = Square(4) # type: Optional[Square]
square = Square(4) # type: Optional[Square]
+# Regression test for https://github.com/psf/black/issues/3756.
+[
+ (
+ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" # aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+ ),
+]
+[
+ ( # aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" # aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+ ),
+]
+
# output
from .config import (
# output
from .config import (
square = Square(4) # type: Optional[Square]
square = Square(4) # type: Optional[Square]
+
+# Regression test for https://github.com/psf/black/issues/3756.
+[
+ ( # aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
+ ),
+]
+[
+ ( # aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" # aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+ ),
+]