Add basic support for template strings (PEP 750)#19333
Closed
brianschubert wants to merge 4 commits intopython:masterfrom
Closed
Add basic support for template strings (PEP 750)#19333brianschubert wants to merge 4 commits intopython:masterfrom
brianschubert wants to merge 4 commits intopython:masterfrom
Conversation
brianschubert
commented
Jun 24, 2025
This comment has been minimized.
This comment has been minimized.
Contributor
|
According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅ |
Collaborator
hauntsaninja
left a comment
There was a problem hiding this comment.
Nice, thanks for working on this!
Modify the AST directly feels a little strange to me. I wonder if it's worth just adding a mypy AST node and handling it in checkexpr, like we do for say DictExpr?
Collaborator
Author
|
Thanks for taking a look! Yeah, I was hoping to find a less hacky approach. I like the sound of your suggestion |
JukkaL
pushed a commit
that referenced
this pull request
Feb 25, 2026
This is based on the #19333 by @brianschubert. I (with the help of Claude Code) modified as suggested by the PR comments to add mypy AST nodes. I'm not very familiar with mypy internals but this seems to work. Tests have been added to check that t-strings are handled as expected. I also tested with Python 3.13 to ensure this doesn't break with older versions. Fixes #19329 --------- Co-authored-by: Brian Schubert <[email protected]> Co-authored-by: Claude <[email protected]>
Collaborator
Author
|
Superseded by #20850 |
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.
Refs #19329