Skip to content

gh-132661: Disallow Template/str concatenation after PEP 750 spec update #135996

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 36 commits into from
Jul 21, 2025

Conversation

davepeck
Copy link
Contributor

@davepeck davepeck commented Jun 26, 2025

Following the steering council decision and corresponding update to PEP750, we are removing support for both implicit and explicit Template/str concatenation.

Copy link
Member

@sobolevn sobolevn left a comment

Choose a reason for hiding this comment

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

Thank you!

@lysnikolaou
Copy link
Member

Happy to do this with your input, or happy to hand it off to you!

Happy to help out / review this PR if you wanna take a stab at it. Feel free to reach out if you have any specific questions.

@davepeck davepeck marked this pull request as ready for review July 8, 2025 23:27
@davepeck
Copy link
Contributor Author

davepeck commented Jul 8, 2025

@lysnikolaou Think this is ready. The only question for me is whether we want to go further with _PyPegen_concatenate_strings().

Copy link
Member

@sobolevn sobolevn left a comment

Choose a reason for hiding this comment

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

Thank you! Several small nitpicks :)

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.

Thanks @davepeck for working on this! Looks great in general. Left a few unimportant comments and one more significant one about how to implement this in the parser. Also, we'll need to change ast_unparse.c around https://github.com/python/cpython/blob/main/Python/ast_unparse.c#L715.

@davepeck
Copy link
Contributor Author

davepeck commented Jul 15, 2025

Looks even better this time. Thanks @davepeck! Left a few comments inline again. It'll probably be good to go once these are addressed.

👍 Thanks, @lysnikolaou for all your patience and help here -- think I took care of the rest.

@efimov-mikhail
Copy link
Contributor

LGTM

@lysnikolaou
Copy link
Member

Looks great and aaalmost there. I have one last thing I missed during my previous reviews.

If I remember correctly, https://github.com/python/cpython/blob/main/Python/codegen.c#L4084-L4093 can be removed as well, because it's only there to handle FormattedValues, which cannot happen anymore.

After that, it's gonna be good to go, promise!

@davepeck
Copy link
Contributor Author

davepeck commented Jul 17, 2025

If I remember correctly, https://github.com/python/cpython/blob/main/Python/codegen.c#L4084-L4093 can be removed as well, because it's only there to handle FormattedValues, which cannot happen anymore.

@lysnikolaou Ah, yes -- thank you. Removed now; tests continue to pass.

(If we prefer, I can replace VISIT() in the else block with a direct ADDOP_LOAD_CONST(). I'd probably add an assert(value->kind == Constant_kind) there, too.)

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.

Looks good to me! Thanks @davepeck! Great work.

@lysnikolaou lysnikolaou added the needs backport to 3.14 bugs and security fixes label Jul 21, 2025
@lysnikolaou lysnikolaou merged commit c5e77af into python:main Jul 21, 2025
46 of 47 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.
🐍🍒⛏🤖

@lysnikolaou lysnikolaou deleted the pep750-concat-update branch July 21, 2025 06:44
@miss-islington-app
Copy link

Sorry, @davepeck and @lysnikolaou, I could not cleanly backport this to 3.14 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker c5e77af131aa0c8832a9ee50c4410731254e4209 3.14

@lysnikolaou
Copy link
Member

I can handle tha backport.

lysnikolaou added a commit to lysnikolaou/cpython that referenced this pull request Jul 21, 2025
…0 spec update (python#135996)

Co-authored-by: sobolevn <mail@sobolevn.me>
Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
(cherry picked from commit c5e77af)
lysnikolaou added a commit that referenced this pull request Jul 21, 2025
…50 spec update (#135996) (#136901)

Co-authored-by: Dave Peck <davepeck@gmail.com>
Co-authored-by: sobolevn <mail@sobolevn.me>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs backport to 3.14 bugs and security fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 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