]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-126469: remove unnecessary error-checking branch in `lexer.c` (#126473)
authorqqwqqw689 <114795525+qqwqqw689@users.noreply.github.com>
Wed, 1 Jan 2025 22:11:29 +0000 (06:11 +0800)
committerGitHub <noreply@github.com>
Wed, 1 Jan 2025 22:11:29 +0000 (22:11 +0000)
Parser/lexer/lexer.c

index 8c868593f944c8cb4bdc7d624b1056d2cad56a2b..dbbb94a407c81d8186aa29189e9a37aab6e22af4 100644 (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);