Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
_PyArena_AddPyObject only steals a ref on success
  • Loading branch information
Erlend E. Aasland
Erlend E. Aasland committed Apr 8, 2021
commit dee38e46b439376b210ac6f564d47e01ee42f640
5 changes: 4 additions & 1 deletion Parser/pegen.c
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,10 @@ _PyPegen_fill_token(Parser *p)
if (t->bytes == NULL) {
return -1;
}
_PyArena_AddPyObject(p->arena, t->bytes);
if (_PyArena_AddPyObject(p->arena, t->bytes) < 0) {
Py_DECREF(t->bytes);
return -1;
}

int lineno = type == STRING ? p->tok->first_lineno : p->tok->lineno;
const char *line_start = type == STRING ? p->tok->multi_line_start : p->tok->line_start;
Expand Down