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.
* Fix incorrect space before colon in if/while stmts
Previously Black would format this code
```
if (foo := True):
print(foo)
```
as
```
if (foo := True) :
print(foo)
```
adding an incorrect space after the RPAR. Buggy code in the
normalize_invisible_parens function caused the colon to be wrapped in
invisible parentheses. The LPAR of that pair was then prefixed with a
single space at the request of the whitespace function.
This commit fixes the accidental skipping of a pre-condition check
which must return True before parenthesis normalization of a specific
child Leaf or Node can happen. The pre-condition check being skipped
was why the colon was wrapped in invisible parentheses.
* Add an entry in CHANGES.md
- `Black` now respects `--skip-string-normalization` when normalizing multiline
docstring quotes (#1637)
- `Black` now respects `--skip-string-normalization` when normalizing multiline
docstring quotes (#1637)
+- `Black` no longer adds an incorrect space after a parenthesized assignment expression
+ in if/while statements (#1655)
+
- fixed a crash when PWD=/ on POSIX (#1631)
### 20.8b1
- fixed a crash when PWD=/ on POSIX (#1631)
### 20.8b1
- `Black` now respects `--skip-string-normalization` when normalizing multiline
docstring quotes (#1637)
- `Black` now respects `--skip-string-normalization` when normalizing multiline
docstring quotes (#1637)
+- `Black` no longer adds an incorrect space after a parenthesized assignment expression
+ in if/while statements (#1655)
+
+- fixed a crash when PWD=/ on POSIX (#1631)
+
### 20.8b1
#### _Packaging_
### 20.8b1
#### _Packaging_
if check_lpar:
if is_walrus_assignment(child):
if check_lpar:
if is_walrus_assignment(child):
- if child.type == syms.atom:
+ elif child.type == syms.atom:
if maybe_make_parens_invisible_in_atom(child, parent=node):
wrap_in_parentheses(node, child, visible=False)
elif is_one_tuple(child):
if maybe_make_parens_invisible_in_atom(child, parent=node):
wrap_in_parentheses(node, child, visible=False)
elif is_one_tuple(child):
(a := a)
if (match := pattern.search(data)) is None:
pass
(a := a)
if (match := pattern.search(data)) is None:
pass
+if (match := pattern.search(data)):
+ pass
[y := f(x), y ** 2, y ** 3]
filtered_data = [y for x in data if (y := f(x)) is None]
(y := f(x))
[y := f(x), y ** 2, y ** 3]
filtered_data = [y for x in data if (y := f(x)) is None]
(y := f(x))
+while (x := f(x)):
+ pass