gh-126469: remove unnecessary error-checking branch in `lexer.c` (#126473)
https://github.com/python/cpython/commit/c810ed7c8e0a7464d19700ba1c8668a406f... commit: c810ed7c8e0a7464d19700ba1c8668a406f1c042 branch: main author: qqwqqw689 <114795525+qqwqqw689@users.noreply.github.com> committer: pablogsal <Pablogsal@gmail.com> date: 2025-01-01T22:11:29Z summary: gh-126469: remove unnecessary error-checking branch in `lexer.c` (#126473) files: M Parser/lexer/lexer.c diff --git a/Parser/lexer/lexer.c b/Parser/lexer/lexer.c index 8c868593f944c8..dbbb94a407c81d 100644 --- a/Parser/lexer/lexer.c +++ b/Parser/lexer/lexer.c @@ -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);
participants (1)
-
pablogsal