Skip to content

gh-132661: Add default value (of "") for Interpolation.expression #136441

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 9 commits into from
Jul 10, 2025

Conversation

davepeck
Copy link
Contributor

@davepeck davepeck commented Jul 8, 2025

Per pending updates to PEP 750, we now provide an empty string default for Interpolation.expression.

If you're using t-string literals, Interpolation.expression is set to the original source text. But if you're writing code that creates Interpolation instances directly, there isn't always an obvious choice for expression.

@davepeck davepeck marked this pull request as ready for review July 9, 2025 00:24
@davepeck davepeck requested a review from lysnikolaou as a code owner July 9, 2025 00:24
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.

Let's add a test that checks that instantiating an Interpolation without an expression actually populates expression with the empty string and it's good to go!

@davepeck
Copy link
Contributor Author

davepeck commented Jul 9, 2025

Let's add a test that checks that instantiating an Interpolation without an expression actually populates expression with the empty string and it's good to go!

Sure; done!

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 @davepeck!

@lysnikolaou lysnikolaou added the needs backport to 3.14 bugs and security fixes label Jul 10, 2025
@lysnikolaou lysnikolaou merged commit f1b8d01 into python:main Jul 10, 2025
46 checks passed
@miss-islington-app
Copy link

Thanks @davepeck for the PR, and @lysnikolaou 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 Jul 10, 2025
…ssion` (pythonGH-136441)

(cherry picked from commit f1b8d01)

Co-authored-by: Dave Peck <davepeck@gmail.com>
@bedevere-app
Copy link

bedevere-app bot commented Jul 10, 2025

GH-136511 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 Jul 10, 2025
lysnikolaou pushed a commit that referenced this pull request Jul 10, 2025
…ession` (GH-136441) (#136511)

Co-authored-by: Dave Peck <davepeck@gmail.com>
AndPuQing pushed a commit to AndPuQing/cpython that referenced this pull request Jul 11, 2025
Pranjal095 pushed a commit to Pranjal095/cpython that referenced this pull request Jul 12, 2025
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
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy