Skip to content

gh-134582: Fix t-strings untokenize() roundtrip removing space between braces - #134603

Merged
pablogsal merged 2 commits into
python:mainfrom
loic-simon:fix-tstring-tokenize-roundtrip
May 25, 2025
Merged

pablogsal merged 2 commits into
python:mainfrom
loic-simon:fix-tstring-tokenize-roundtrip

Conversation

@loic-simon

@loic-simon loic-simon commented May 23, 2025 •

Copy link
Copy Markdown
Contributor

Avoid round-tripping t"{ {}}" (an interpolation with an empty dictionary) into t"{{}}" (two literal braces).

This extend the mechanism used in tokenize.Untokenizer.compat, to handle t-strings alongside f-strings.

@pablogsal pablogsal added the needs backport to 3.14 bugs and security fixes label May 25, 2025
@pablogsal

Copy link
Copy Markdown
Member

Thanks for your contribution @loic-simon 🚀

@pablogsal
pablogsal merged commit 52509cc into python:main May 25, 2025
@miss-islington-app

Copy link
Copy Markdown

Thanks @loic-simon for the PR, and @pablogsal for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request May 25, 2025
…between braces (pythonGH-134603)

(cherry picked from commit 52509cc)

Co-authored-by: Loïc Simon <loic.pano@gmail.com>
@bedevere-app

bedevere-app Bot commented May 25, 2025

Copy link
Copy Markdown

GH-134659 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label May 25, 2025
pablogsal pushed a commit that referenced this pull request May 25, 2025
… between braces (GH-134603) (#134659)

gh-134582: Fix t-strings untokenize() roundtrip removing space between braces (GH-134603)
(cherry picked from commit 52509cc)

Co-authored-by: Loïc Simon <loic.pano@gmail.com>
Pranjal095 pushed a commit to Pranjal095/cpython that referenced this pull request Jul 12, 2025
taegyunkim pushed a commit to taegyunkim/cpython that referenced this pull request Aug 4, 2025
gostak-dd pushed a commit to gostak-dd/cpython that referenced this pull request Jun 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants