Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.7k
gh-135148: Correctly handle f/t strings with comments and debug expressions#135198
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
bd49471 to5f8456eCompareParser/lexer/lexer.c Outdated
| in_string=0;// Whether we're currently inside a string | ||
| string_quote=0;// The quote character for current string (' or ") | ||
| // Process each character of input |
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.
@lysnikolaou please read this carefully. I am mostly sure its correct but itreally needs some extra eyes
lysnikolaou left a comment
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.
Yeah, I was thinking something very similar as a solution, too! I found one problem, but it looks good otherwise.
Uh oh!
There was an error while loading.Please reload this page.
When you're done making the requested changes, leave the comment: |
lysnikolaou left a comment• edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
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.
This looks good now! Thanks@pablogsal!
I left a couple of inline comments for some very minor improvements.
| if (!in_string) { | ||
| in_string=1; | ||
| quote_char=ch; | ||
| } | ||
| elseif (ch==quote_char) { | ||
| in_string=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.
This only works because there's always an odd number of quotes in aSTRING token and we're sure that allSTRING tokens will be valid at this point. Maybe add a comment to explain that?
Parser/lexer/lexer.c Outdated
| charquote_char=0; | ||
| charstring_quote=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.
Do we need both of these?
lysnikolaou commentedJul 13, 2025
@pablogsal Ping here. Will we be able to get thins into 3.13 before the rc release? If you don't have time to work on it, I'm okay taking it over. |
pablogsal commentedJul 13, 2025
I am travelling today :( If you want and have the time you can push the fixes to the PR and land it but if you don't have time maybe I can get to it at night. |
lysnikolaou left a comment
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.
Pushed a commit with a couple of additions. LGTM now! Let's merge it.
ef66fb5 intopython:mainUh oh!
There was an error while loading.Please reload this page.
lysnikolaou commentedJul 16, 2025
Are we backporting this? |
pablogsal commentedJul 16, 2025
We should indeed |
Thanks@pablogsal for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13. |
Thanks@pablogsal for the PR 🌮🎉.. I'm working now to backport this PR to: 3.14. |
Sorry,@pablogsal, I could not cleanly backport this to |
… expressions (pythonGH-135198)(cherry picked from commitef66fb5)Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
GH-136720 is a backport of this pull request to the3.14 branch. |
GH-136899 is a backport of this pull request to the3.13 branch. |
…d debug expressions (pythonGH-135198) (python#136720)
Uh oh!
There was an error while loading.Please reload this page.