@@ -775,15 +775,15 @@ _PyPegen_expect_soft_keyword(Parser *p, const char *keyword)
775
775
if (t -> type != NAME ) {
776
776
return NULL ;
777
777
}
778
- char * s = PyBytes_AsString (t -> bytes );
778
+ char * s = PyBytes_AsString (t -> bytes );
779
779
if (!s ) {
780
+ p -> error_indicator = 1 ;
780
781
return NULL ;
781
782
}
782
783
if (strcmp (s , keyword ) != 0 ) {
783
784
return NULL ;
784
785
}
785
- expr_ty res = _PyPegen_name_token (p );
786
- return res ;
786
+ return _PyPegen_name_token (p );
787
787
}
788
788
789
789
Token *
@@ -809,10 +809,12 @@ _PyPegen_name_token(Parser *p)
809
809
}
810
810
char * s = PyBytes_AsString (t -> bytes );
811
811
if (!s ) {
812
+ p -> error_indicator = 1 ;
812
813
return NULL ;
813
814
}
814
815
PyObject * id = _PyPegen_new_identifier (p , s );
815
816
if (id == NULL ) {
817
+ p -> error_indicator = 1 ;
816
818
return NULL ;
817
819
}
818
820
return Name (id , Load , t -> lineno , t -> col_offset , t -> end_lineno , t -> end_col_offset ,
@@ -905,6 +907,7 @@ _PyPegen_number_token(Parser *p)
905
907
906
908
char * num_raw = PyBytes_AsString (t -> bytes );
907
909
if (num_raw == NULL ) {
910
+ p -> error_indicator = 1 ;
908
911
return NULL ;
909
912
}
910
913
@@ -917,11 +920,13 @@ _PyPegen_number_token(Parser *p)
917
920
PyObject * c = parsenumber (num_raw );
918
921
919
922
if (c == NULL ) {
923
+ p -> error_indicator = 1 ;
920
924
return NULL ;
921
925
}
922
926
923
927
if (PyArena_AddPyObject (p -> arena , c ) < 0 ) {
924
928
Py_DECREF (c );
929
+ p -> error_indicator = 1 ;
925
930
return NULL ;
926
931
}
927
932
0 commit comments