summaryrefslogtreecommitdiffstats
path: root/Parser/tokenizer.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2007-08-29 18:54:41 (GMT)
committerGuido van Rossum <guido@python.org>2007-08-29 18:54:41 (GMT)
commite3e3701f8f1a3c9a4ae84cde793e421ce0460d83 (patch)
tree9dd63a05660e28515b05214e53dea975962b9038 /Parser/tokenizer.c
parent18c3ff887f95e7b566b36faf97d457372c04c213 (diff)
downloadcpython-e3e3701f8f1a3c9a4ae84cde793e421ce0460d83.zip
cpython-e3e3701f8f1a3c9a4ae84cde793e421ce0460d83.tar.gz
cpython-e3e3701f8f1a3c9a4ae84cde793e421ce0460d83.tar.bz2
Fix issue # 1037 (sort of).
Diffstat (limited to 'Parser/tokenizer.c')
-rw-r--r--Parser/tokenizer.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/Parser/tokenizer.c b/Parser/tokenizer.c
index 6320f75..d86615f 100644
--- a/Parser/tokenizer.c
+++ b/Parser/tokenizer.c
@@ -1080,8 +1080,14 @@ indenterror(struct tok_state *tok)
static int
verify_identifier(char *start, char *end)
{
- PyObject *s = PyUnicode_DecodeUTF8(start, end-start, NULL);
- int result = PyUnicode_IsIdentifier(s);
+ PyObject *s;
+ int result;
+ s = PyUnicode_DecodeUTF8(start, end-start, NULL);
+ if (s == NULL) {
+ PyErr_Clear();
+ return 0;
+ }
+ result = PyUnicode_IsIdentifier(s);
Py_DECREF(s);
return result;
}