Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e3e3701

Browse files
committed
Fix issue # 1037 (sort of).
1 parent 18c3ff8 commit e3e3701

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

Parser/tokenizer.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1080,8 +1080,14 @@ indenterror(struct tok_state *tok)
10801080
static int
10811081
verify_identifier(char *start, char *end)
10821082
{
1083-
PyObject *s = PyUnicode_DecodeUTF8(start, end-start, NULL);
1084-
int result = PyUnicode_IsIdentifier(s);
1083+
PyObject *s;
1084+
int result;
1085+
s = PyUnicode_DecodeUTF8(start, end-start, NULL);
1086+
if (s == NULL) {
1087+
PyErr_Clear();
1088+
return 0;
1089+
}
1090+
result = PyUnicode_IsIdentifier(s);
10851091
Py_DECREF(s);
10861092
return result;
10871093
}

0 commit comments

Comments
 (0)