Skip to content

Commit c011d1b

Browse files
authored
[3.9] Backport GH-20440: Set p->error_indicator in more places (GH-20457)
1 parent 1bfe659 commit c011d1b

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Parser/pegen/pegen.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -808,10 +808,12 @@ _PyPegen_name_token(Parser *p)
808808
}
809809
char* s = PyBytes_AsString(t->bytes);
810810
if (!s) {
811+
p->error_indicator = 1;
811812
return NULL;
812813
}
813814
PyObject *id = _PyPegen_new_identifier(p, s);
814815
if (id == NULL) {
816+
p->error_indicator = 1;
815817
return NULL;
816818
}
817819
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)
904906

905907
char *num_raw = PyBytes_AsString(t->bytes);
906908
if (num_raw == NULL) {
909+
p->error_indicator = 1;
907910
return NULL;
908911
}
909912

@@ -916,11 +919,13 @@ _PyPegen_number_token(Parser *p)
916919
PyObject *c = parsenumber(num_raw);
917920

918921
if (c == NULL) {
922+
p->error_indicator = 1;
919923
return NULL;
920924
}
921925

922926
if (PyArena_AddPyObject(p->arena, c) < 0) {
923927
Py_DECREF(c);
928+
p->error_indicator = 1;
924929
return NULL;
925930
}
926931

0 commit comments

Comments
 (0)