Skip to content

Commit fd8b60a

Browse files
committed
Some cleanups
1 parent dcd221f commit fd8b60a

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

Parser/tokenizer.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1815,13 +1815,10 @@ tok_get_normal_mode(struct tok_state *tok, tokenizer_mode* current_tok, struct t
18151815
return MAKE_TOKEN(syntaxerror(tok, "f-string expression part cannot include '#'"));
18161816
}
18171817

1818-
const char *prefix, *p, *type_start;
1818+
const char* p = NULL;
1819+
const char *prefix, *type_start;
18191820
int current_starting_col_offset;
18201821

1821-
// if (tok->tok_extra_tokens) {
1822-
// p = tok->start;
1823-
// }
1824-
18251822
while (c != EOF && c != '\n') {
18261823
c = tok_nextc(tok);
18271824
}

Python/Python-tokenize.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -193,18 +193,18 @@ tokenizeriter_next(tokenizeriterobject *it)
193193
return NULL;
194194
}
195195
const char *line_start = ISSTRINGLIT(type) ? it->tok->multi_line_start : it->tok->line_start;
196-
int lineno = ISSTRINGLIT(type) ? it->tok->first_lineno : it->tok->lineno;
197-
int end_lineno = it->tok->lineno;
198-
int col_offset = -1;
199-
int end_col_offset = -1;
196+
Py_ssize_t lineno = ISSTRINGLIT(type) ? it->tok->first_lineno : it->tok->lineno;
197+
Py_ssize_t end_lineno = it->tok->lineno;
198+
Py_ssize_t col_offset = -1;
199+
Py_ssize_t end_col_offset = -1;
200200
if (token.start != NULL && token.start >= line_start) {
201201
col_offset = _PyPegen_byte_offset_to_character_offset(line, token.start - line_start);
202202
}
203203
if (token.end != NULL && token.end >= it->tok->line_start) {
204204
end_col_offset = _PyPegen_byte_offset_to_character_offset(line, token.end - it->tok->line_start);
205205
}
206206

207-
return Py_BuildValue("(NiiiiiN)", str, type, lineno, end_lineno, col_offset, end_col_offset, line);
207+
return Py_BuildValue("(NinnnnN)", str, type, lineno, end_lineno, col_offset, end_col_offset, line);
208208
}
209209

210210
static void

0 commit comments

Comments
 (0)