Skip to content

Commit 88d52b8

Browse files
gh-149277: Fix error position for invalid numeric literals
1 parent 70e365c commit 88d52b8

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fix the :exec:`SyntaxError` caret position for invalid numeric literals to
2+
point at the first invalid character instead of the last valid one.

Parser/lexer/lexer.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,6 @@ verify_end_of_number(struct tok_state *tok, int c, const char *kind) {
352352
}
353353
else /* In future releases, only error will remain. */
354354
if (c < 128 && is_potential_identifier_char(c)) {
355-
tok_backup(tok, c);
356355
_PyTokenizer_syntaxerror(tok, "invalid %s literal", kind);
357356
return 0;
358357
}

0 commit comments

Comments
 (0)