Skip to content

Commit 899509a

Browse files
committed
Fix an unbound local variable error raised in release mode (the -O Python switch)
This was an omission on my part, even though there had been similar patterns in code where I was careful not to introduce this exact kind of issue -- code effectively _depending_ on evaluation of `assert` statements.
1 parent b930beb commit 899509a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/csspring/syntax/parsing.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,8 @@ def consume_list_of_component_values(input: Input, *, stop_token: type[Token | N
411411

412412
def consume_simple_block(input: Input, *, to: Appender[SimpleBlock]) -> SimpleBlock:
413413
"""Implements http://drafts.csswg.org/css-syntax/#consume-simple-block."""
414-
assert isinstance(token := input.next_token(), (OpenBraceToken, OpenBracketToken, OpenParenToken))
414+
token = input.next_token()
415+
assert isinstance(token, (OpenBraceToken, OpenBracketToken, OpenParenToken))
415416
ending_token = token.mirror_type
416417
block = SimpleBlock()
417418
consume_token(input, to=block)

0 commit comments

Comments
 (0)