diff Parser/tokenizer.c @ 43002:e142cd4b5710

Fix issue # 1037 (sort of).
author Guido van Rossum <guido@python.org>
date Wed, 29 Aug 2007 18:54:41 +0000
parents 3a56e73ae919
children 165934bc4429
line wrap: on
line diff
--- a/Parser/tokenizer.c	Wed Aug 29 18:47:16 2007 +0000
+++ b/Parser/tokenizer.c	Wed Aug 29 18:54:41 2007 +0000
@@ -1080,8 +1080,14 @@
 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;
 }