File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1717
1818<!-- Changes that affect Black's stable style -->
1919
20+ - Fix crash when a leaf's bracket metadata is read before bracket tracking has visited
21+ it (#5215 )
2022- Fix crash when a standalone comment sits between tokens of a comprehension or lambda
2123 (#5144 )
2224- Fix crash when a comment-only ` # fmt: off ` /` # fmt: on ` block is followed by a ` with `
Original file line number Diff line number Diff line change @@ -482,6 +482,7 @@ def __init__(
482482 self ._prefix = prefix
483483 self .fixers_applied : list [Any ] | None = fixers_applied [:]
484484 self .children = []
485+ self .bracket_depth = 0
485486 self .opening_bracket = opening_bracket
486487 self .fmt_pass_converted_first_leaf = fmt_pass_converted_first_leaf
487488
Original file line number Diff line number Diff line change 1+ """Tests for blib2to3 concrete syntax trees."""
2+
3+ from blib2to3 .pgen2 import token
4+ from blib2to3 .pytree import Leaf
5+
6+
7+ def test_leaf_initializes_bracket_metadata () -> None :
8+ leaf = Leaf (token .NAME , "name" )
9+
10+ assert leaf .bracket_depth == 0
11+ assert leaf .opening_bracket is None
You can’t perform that action at this time.
0 commit comments