X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/75f99bded33abe962ca08bf16c77635ac9ca00a1..8ed3e3d07ea3e6d62e3e533e69f96a0ff148cd5d:/src/black/linegen.py diff --git a/src/black/linegen.py b/src/black/linegen.py index caffbab..91fdeef 100644 --- a/src/black/linegen.py +++ b/src/black/linegen.py @@ -915,6 +915,15 @@ def normalize_invisible_parens( node.insert_child(index, Leaf(token.LPAR, "")) node.append_child(Leaf(token.RPAR, "")) break + elif ( + index == 1 + and child.type == token.STAR + and node.type == syms.except_clause + ): + # In except* (PEP 654), the star is actually part of + # of the keyword. So we need to skip the insertion of + # invisible parentheses to work more precisely. + continue elif not (isinstance(child, Leaf) and is_multiline_string(child)): wrap_in_parentheses(node, child, visible=False)