-
-
Notifications
You must be signed in to change notification settings - Fork 30.3k
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: fix an error in lexer.c. #126473
base: main
Are you sure you want to change the base?
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. <[email protected]>
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 willl try. |
tok->done = E_ERROR; | ||
return 0; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest to replace removed code with: assert(invalid >= 0);
.
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