Skip to content

Add basic support for template strings (PEP 750)#19333

Closed
brianschubert wants to merge 4 commits intopython:masterfrom
brianschubert:pep-750-template-strings
Closed

Add basic support for template strings (PEP 750)#19333
brianschubert wants to merge 4 commits intopython:masterfrom
brianschubert:pep-750-template-strings

Conversation

@brianschubert
Copy link
Collaborator

Refs #19329

@github-actions

This comment has been minimized.

@github-actions
Copy link
Contributor

According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅

Copy link
Collaborator

@hauntsaninja hauntsaninja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

@brianschubert
Copy link
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]>
@brianschubert
Copy link
Collaborator Author

Superseded by #20850

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants