From: qqwqqw689 <114795525+qqwqqw689@users.noreply.github.com> Date: Wed, 1 Jan 2025 22:11:29 +0000 (+0800) Subject: gh-126469: remove unnecessary error-checking branch in `lexer.c` (#126473) X-Git-Tag: v3.14.0a4~155 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c810ed7c8e0a7464d19700ba1c8668a406f1c042;p=thirdparty%2FPython%2Fcpython.git gh-126469: remove unnecessary error-checking branch in `lexer.c` (#126473) --- diff --git a/Parser/lexer/lexer.c b/Parser/lexer/lexer.c index 8c868593f944..dbbb94a407c8 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);