Skip to content

Commit

Permalink
Add an assertion about bracket_stack >= 0
Browse files Browse the repository at this point in the history
  • Loading branch information
isidentical committed Mar 26, 2023
1 parent 0623fc3 commit 83b2adf
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions Parser/tokenizer.c
Original file line number Diff line number Diff line change
Expand Up @@ -2395,6 +2395,7 @@ tok_get_normal_mode(struct tok_state *tok, tokenizer_mode* current_tok, struct t
syntactical construct with it; we'll throw an unmatched
parentheses error. */
if (tok->tok_mode_stack_index > 0 && opening == '{') {
assert(current_tok->bracket_stack >= 0);
int previous_bracket = current_tok->bracket_stack - 1;
if (previous_bracket == current_tok->bracket_mark[current_tok->bracket_mark_index]) {
return MAKE_TOKEN(syntaxerror(tok, "f-string: unmatched '%c'", c));
Expand Down

0 comments on commit 83b2adf

Please sign in to comment.