https://github.com/python/cpython/commit/c810ed7c8e0a7464d19700ba1c8668a406f1c042
commit: c810ed7c8e0a7464d19700ba1c8668a406f1c042
branch: main
author: qqwqqw689 <[email protected]>
committer: pablogsal <[email protected]>
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);

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]

Reply via email to