diff options
author | Benjamin Peterson <benjamin@python.org> | 2015-04-21 16:05:19 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2015-04-21 16:05:19 (GMT) |
commit | d73aca769f1f6eebb46faa9161cbebe806db3659 (patch) | |
tree | d257c03a998c63a1a89b9e36bb820c43b1beb0db /Parser | |
parent | 6de708fd46207f6af67d4c0e8902f0d56ea4495c (diff) | |
download | cpython-d73aca769f1f6eebb46faa9161cbebe806db3659.zip cpython-d73aca769f1f6eebb46faa9161cbebe806db3659.tar.gz cpython-d73aca769f1f6eebb46faa9161cbebe806db3659.tar.bz2 |
do not call into python api if an exception is set (#24022)
Diffstat (limited to 'Parser')
-rw-r--r-- | Parser/tokenizer.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/Parser/tokenizer.c b/Parser/tokenizer.c index 22accd1..5e041ea 100644 --- a/Parser/tokenizer.c +++ b/Parser/tokenizer.c @@ -1301,6 +1301,8 @@ verify_identifier(struct tok_state *tok) { PyObject *s; int result; + if (tok->decoding_erred) + return 0; s = PyUnicode_DecodeUTF8(tok->start, tok->cur - tok->start, NULL); if (s == NULL || PyUnicode_READY(s) == -1) { if (PyErr_ExceptionMatches(PyExc_UnicodeDecodeError)) { @@ -1469,11 +1471,8 @@ tok_get(struct tok_state *tok, char **p_start, char **p_end) c = tok_nextc(tok); } tok_backup(tok, c); - if (nonascii && - !verify_identifier(tok)) { - tok->done = E_IDENTIFIER; + if (nonascii && !verify_identifier(tok)) return ERRORTOKEN; - } *p_start = tok->start; *p_end = tok->cur; return NAME; |