There was an error while loading. Please reload this page.
1 parent 3be14e2 commit dee8cf3Copy full SHA for dee8cf3
2 files changed
Parser/tokenizer/helpers.c
@@ -334,10 +334,9 @@ _PyTokenizer_ensure_utf8(const char *line, struct tok_state *tok, int lineno)
334
}
335
336
if (badchar) {
337
- int col_offset = (int)(badchar - line_start) + 1;
338
_PyTokenizer_syntaxerror_at(
339
- tok, line_start, badchar - line_start, lineno,
340
- col_offset, col_offset,
+ tok, line_start, badchar - line_start + 1, lineno,
+ -1, -1,
341
"Non-UTF-8 code starting with '\\x%.2x'"
342
"%s%V on line %i, "
343
"but no encoding declared; "
Parser/tokenizer/helpers.h
@@ -6,6 +6,9 @@
6
#include "../lexer/state.h"
7
8
int _PyTokenizer_syntaxerror(struct tok_state *tok, const char *format, ...);
9
+/* Positive range columns are 1-based byte columns. A start column of -1
10
+ derives the character column from the reporting cursor; an end column of
11
+ -1 uses the start column. */
12
int _PyTokenizer_syntaxerror_known_range(struct tok_state *tok, int col_offset, int end_col_offset, const char *format, ...);
13
int _PyTokenizer_syntaxerror_at(
14
struct tok_state *tok, const char *line_start, Py_ssize_t cursor_offset,
0 commit comments