-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Allow NUL
character in f-strings
#7378
Conversation
// The condition is to differentiate between the `NUL` (`\0`) character | ||
// in the source code and the one returned by `self.cursor.first()` when | ||
// we reach the end of the source code. | ||
EOF_CHAR if self.cursor.is_eof() => { |
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.
We could move this in the catch-all branch but that would mean that the check will be performed for almost every character.
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.
Hmm yeah. That's why using self.cursor.first()
is "dangerous" and I prefer to use bump
wherever I can. Can you do a quick double check if any other code needs to check for self.cursor.is_eof()
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, that's the only place where it seems necessary.
// The condition is to differentiate between the `NUL` (`\0`) character | ||
// in the source code and the one returned by `self.cursor.first()` when | ||
// we reach the end of the source code. | ||
EOF_CHAR if self.cursor.is_eof() => { |
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.
Hmm yeah. That's why using self.cursor.first()
is "dangerous" and I prefer to use bump
wherever I can. Can you do a quick double check if any other code needs to check for self.cursor.is_eof()
Summary
This PR fixes the bug to allow
NUL
(\0
) character inside f-strings.Test Plan
Add test case with
NUL
character inside f-string.