Skip to content

Commit 452e6fa

Browse files
committed
pythongh-153569: Remove assertion-only lexer bookkeeping
1 parent 39436f7 commit 452e6fa

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

‎Parser/lexer/string.c‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,18 +83,17 @@ finish_ftstring_expr(struct tok_state *tok, ftstring_state *state,
8383
PyObject *res;
8484
if (comments != NULL && comments->count > 0) {
8585
Py_ssize_t stripped_size = expr_len;
86-
_PyTok_Off previous_end = state->expr_span.start;
8786
Py_ssize_t comment_count = 0;
8887
for (Py_ssize_t i = 0; i < comments->count; i++) {
8988
_PyTok_Span comment = comments->spans[i];
9089
assert(_PyTok_SpanIsValid(comment));
91-
assert(comment.start >= previous_end);
90+
assert(comment.start >= (i == 0 ? state->expr_span.start
91+
: comments->spans[i - 1].end));
9292
if (comment.start >= state->expr_span.end) {
9393
break;
9494
}
9595
assert(comment.end <= state->expr_span.end);
9696
stripped_size -= comment.end - comment.start;
97-
previous_end = comment.end;
9897
comment_count++;
9998
}
10099
char *stripped = PyMem_Malloc((size_t)stripped_size);

0 commit comments

Comments
 (0)