-
-
Notifications
You must be signed in to change notification settings - Fork 31k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gh-126469: remove unnecessary error-checking branch in lexer.c
#126473
Conversation
Unfortunately, fix seems to be wrong: pr has CI failures, related to it. |
It is true that the if statement is not executed (at least in the tests) but the fix is not right as tests are failing. Maybe we should really focus on writing a test that exercise that code path and if we cannot, we could refactor the logic there. |
Co-authored-by: Tomas R. <tomas.roun8@gmail.com>
Actually I'm a rookie, I'd like to wait for some advices.😁 |
The tests seem to be failing because the error that is being raised is - if (invalid < 0) {
- Py_DECREF(s);
- tok->done = E_ERROR;
- return 0;
- } |
I will try. |
lexer.c
Thanks for your contribution @qqwqqw689 |
(I've updated the PR since we added new CI checks) |
In file lexer.c we have
link
But for function _PyUnicode_ScanIdentifier in unicodeobject.c file
link
This function will never return a invalid valiable <0, so
will never be executed.
I make this pr to fix it.
lexer.c
. #126469