Skip to content

gh-133581: Improve AST unparsing of t-strings #133635

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

Merged
merged 5 commits into from
May 8, 2025

Conversation

JelleZijlstra
Copy link
Member

@JelleZijlstra JelleZijlstra commented May 8, 2025

Fix unparsing of empty t-strings, and use the string value in unparsing interpolations.

Copy link
Member

@lysnikolaou lysnikolaou left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks @JelleZijlstra! Let's backport this to 3.14 as well.

@lysnikolaou lysnikolaou added the needs backport to 3.14 bugs and security fixes label May 8, 2025
@JelleZijlstra JelleZijlstra merged commit bfac7d2 into python:main May 8, 2025
45 checks passed
@miss-islington-app
Copy link

Thanks @JelleZijlstra for the PR 🌮🎉.. 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 8, 2025
(cherry picked from commit bfac7d2)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
@bedevere-app
Copy link

bedevere-app bot commented May 8, 2025

GH-133666 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 8, 2025
@JelleZijlstra JelleZijlstra deleted the tstr-round branch May 8, 2025 13:36
JelleZijlstra added a commit that referenced this pull request May 8, 2025
…3666)

gh-133581: Improve AST unparsing of t-strings (GH-133635)
(cherry picked from commit bfac7d2)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
@nascheme
Copy link
Member

nascheme commented May 9, 2025

Looks like some refleak buildbots started failing after this.

https://buildbot.python.org/#/builders/1735/builds/6

test.test_future_stmt.test_future leaked [28, 28, 28] references, sum=84
test.test_future_stmt.test_future leaked [84, 84, 84] memory blocks, sum=252
Re-running test.test_future_stmt.test_future in verbose mode
test.test_future_stmt.test_future leaked [28, 28, 28] references, sum=84
test.test_future_stmt.test_future leaked [84, 84, 84] memory blocks, sum=252

@nascheme
Copy link
Member

nascheme commented May 9, 2025

Yup, it bisects to this commit on the 3.14 branch:

commit 153496921a05e205d4c45c4a64888ccd43148897 (HEAD)
Author: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Date:   Thu May 8 15:40:44 2025 +0200

    [3.14] gh-133581: Improve AST unparsing of t-strings (GH-133635) (#133666 

@JelleZijlstra
Copy link
Member Author

Thanks for flagging, I'll investigate. Must be one of the changes in ast_unparse.c but from staring at the code I don't see anything wrong yet.

@JelleZijlstra
Copy link
Member Author

Fix in #133724. The issue was in the existing code, it just wasn't tested before.

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.

3 participants