[3.9] Backport GH-20440: Set p->error_indicator in more places (GH-20457)

This commit is contained in:
Lysandros Nikolaou 2020-05-27 23:20:43 +03:00 committed by GitHub
parent 1bfe659ee5
commit c011d1b5be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 0 deletions

View File

@ -808,10 +808,12 @@ _PyPegen_name_token(Parser *p)
}
char* s = PyBytes_AsString(t->bytes);
if (!s) {
p->error_indicator = 1;
return NULL;
}
PyObject *id = _PyPegen_new_identifier(p, s);
if (id == NULL) {
p->error_indicator = 1;
return NULL;
}
return Name(id, Load, t->lineno, t->col_offset, t->end_lineno, t->end_col_offset,
@ -904,6 +906,7 @@ _PyPegen_number_token(Parser *p)
char *num_raw = PyBytes_AsString(t->bytes);
if (num_raw == NULL) {
p->error_indicator = 1;
return NULL;
}
@ -916,11 +919,13 @@ _PyPegen_number_token(Parser *p)
PyObject *c = parsenumber(num_raw);
if (c == NULL) {
p->error_indicator = 1;
return NULL;
}
if (PyArena_AddPyObject(p->arena, c) < 0) {
Py_DECREF(c);
p->error_indicator = 1;
return NULL;
}