Repository navigation
gh-146448: Add regression test for != followed by a format spec in t-strings - #146614
Open
joshuaswanson wants to merge 2 commits into
Open
joshuaswanson wants to merge 2 commits into
joshuaswanson wants to merge 2 commits into
Conversation
Contributor
|
Hiya @joshuaswanson, Great fix! just a small detail, Shouldn't we peek at the buffer directly here? if (c == '!' && (tok->cur >= tok->inp || *tok->cur != '=')) {
is_punctuation = 1;
} |
|
This PR is stale because it has been open for 30 days with no activity. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
t'{0!=0:}'used to produce an interpolation whose expression was0, because the lexer treated the!of!=as the start of a conversion specifier.The lexer refactor on main already handles this case.
_PyLexer_ftstring_punctuationpeeks at the character after!and leaves!=alone.This PR originally added the same lookahead in
Parser/lexer/lexer.c. After merging main that change is redundant, so the PR now only adds a regression test inLib/test/test_tstring.pyfort"{0!=0:}"andt"{0!=0:s}".The branch still contains the NEWS entry from the original fix. I can remove it if a test-only change should skip news.