aboutsummaryrefslogtreecommitdiff
path: root/Parser
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2015-04-21 12:07:06 -0400
committerBenjamin Peterson <benjamin@python.org>2015-04-21 12:07:06 -0400
commit273a720f876e754013e17fab0ab9b599284239f7 (patch)
tree3467634eaf7246dd125f8aa8ebad732e001a6915 /Parser
parentGet rid of unused-but-set-variable warning. len and len2 should be equal and ... (diff)
parentdo not call into python api if an exception is set (#24022) (diff)
downloadcpython-273a720f876e754013e17fab0ab9b599284239f7.tar.gz
cpython-273a720f876e754013e17fab0ab9b599284239f7.tar.bz2
cpython-273a720f876e754013e17fab0ab9b599284239f7.zip
merge 3.4 (#24022)
Diffstat (limited to 'Parser')
-rw-r--r--Parser/tokenizer.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/Parser/tokenizer.c b/Parser/tokenizer.c
index ef7b19fb42f..ac413a8455b 100644
--- a/Parser/tokenizer.c
+++ b/Parser/tokenizer.c
@@ -1307,6 +1307,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)) {
@@ -1475,11 +1477,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;