* [3.9] Fix possible refleak involving _PyArena_AddPyObject (GH-25289).
(cherry picked from commit
c0e11a3ceb9427e09db4224f394c7789bf6deec5)
Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@innova.no>
* Update Parser/pegen/pegen.c
Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
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;