Skip to content

Commit f78606c

Browse files
committed
gh-153568: Preserve keyword token text
1 parent 8cf4db0 commit f78606c

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

Parser/pegen.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ initialize_token(Parser *p, Token *parser_token, struct token *new_token, int to
220220
assert(parser_token != NULL);
221221

222222
parser_token->type = (token_type == NAME) ? _get_keyword_or_name_type(p, new_token) : token_type;
223-
if (token_needs_text(parser_token->type)) {
223+
if (token_type == NAME || token_needs_text(parser_token->type)) {
224224
parser_token->bytes = PyBytes_FromStringAndSize(
225225
new_token->start, new_token->end - new_token->start);
226226
if (parser_token->bytes == NULL) {

0 commit comments

Comments
 (0)