gh-126469: remove unnecessary error-checking branch in lexer.c (#126473)

This commit is contained in:
qqwqqw689 2025-01-02 06:11:29 +08:00 committed by GitHub
parent a327810169
commit c810ed7c8e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -329,11 +329,7 @@ verify_identifier(struct tok_state *tok)
return 0;
}
Py_ssize_t invalid = _PyUnicode_ScanIdentifier(s);
if (invalid < 0) {
Py_DECREF(s);
tok->done = E_ERROR;
return 0;
}
assert(invalid >= 0);
assert(PyUnicode_GET_LENGTH(s) > 0);
if (invalid < PyUnicode_GET_LENGTH(s)) {
Py_UCS4 ch = PyUnicode_READ_CHAR(s, invalid);