diff --git a/src/pyink/linegen.py b/src/pyink/linegen.py index 76a2e4f78e2..b9a998d33ea 100644 --- a/src/pyink/linegen.py +++ b/src/pyink/linegen.py @@ -1008,6 +1008,13 @@ def bracket_split_build_line( ) if isinstance(node, Node) and isinstance(node.prev_sibling, Leaf) ) + # Except the false negatives above for PEP 604 unions where we + # can't add the comma. + and not ( + leaves[0].parent + and leaves[0].parent.next_sibling + and leaves[0].parent.next_sibling.type == token.VBAR + ) ) if original.is_import or no_commas: