diff options
author | Lysandros Nikolaou <lisandrosnik@gmail.com> | 2020-05-27 20:20:43 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-27 20:20:43 (GMT) |
commit | c011d1b5be65bb6be52de4d311b21a464fe7b0dd (patch) | |
tree | 4c001563c7bd0fb8c39b7f540bd887518ff6a8cc /Parser/pegen | |
parent | 1bfe659ee5c6f07c55487d9ef7c2e653cf697f72 (diff) | |
download | cpython-c011d1b5be65bb6be52de4d311b21a464fe7b0dd.zip cpython-c011d1b5be65bb6be52de4d311b21a464fe7b0dd.tar.gz cpython-c011d1b5be65bb6be52de4d311b21a464fe7b0dd.tar.bz2 |
[3.9] Backport GH-20440: Set p->error_indicator in more places (GH-20457)
Diffstat (limited to 'Parser/pegen')
-rw-r--r-- | Parser/pegen/pegen.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Parser/pegen/pegen.c b/Parser/pegen/pegen.c index b858b6b..6608fd8 100644 --- a/Parser/pegen/pegen.c +++ b/Parser/pegen/pegen.c @@ -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; } |