GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-135148: Correctly handle f/t strings with comments and debug expressions by pablogsal · Pull Request #135198 · python/cpython

Conversation

@pablogsal

@pablogsal pablogsal commented Jun 6, 2025 •
edited by bedevere-app Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member
  • Issue: Parts of strings that look like comments being stripped out of nested strings with debug specifier #135148

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@pablogsal
pablogsal requested a review from lysnikolaou as a code owner June 6, 2025 01:18
@bedevere-app bedevere-app Bot added the awaiting core review label Jun 6, 2025
@bedevere-app bedevere-app Bot mentioned this pull request Jun 6, 2025
Parts of strings that look like comments being stripped out of nested strings with debug specifier #135148
Closed
@pablogsal
pablogsal force-pushed the gh-135148 branch 2 times, most recently from bd49471 to 5f8456e Compare June 6, 2025 01:22
@pablogsal
pythongh-135148: Correctly handle f/t strings with comments and debug…
ef9d22f
… expressions
@pablogsal
pablogsal force-pushed the gh-135148 branch from 5f8456e to ef9d22f Compare June 6, 2025 01:24
pablogsal
pablogsal commented Jun 6, 2025
View reviewed changes
Comment thread Parser/lexer/lexer.c Outdated
in_string = 0; // Whether we're currently inside a string
string_quote = 0; // The quote character for current string (' or ")

// Process each character of input

@pablogsal pablogsal Jun 6, 2025

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

@lysnikolaou please read this carefully. I am mostly sure its correct but it really needs some extra eyes

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@Wulian233 Wulian233 mentioned this pull request Jun 6, 2025
gh-134036: Improve error messages for invalid raise statements #134077
Merged
lysnikolaou
lysnikolaou requested changes Jun 6, 2025
View reviewed changes

@lysnikolaou lysnikolaou left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Yeah, I was thinking something very similar as a solution, too! I found one problem, but it looks good otherwise.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Parser/lexer/lexer.c Resolved

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot added awaiting changes and removed awaiting core review labels Jun 6, 2025
@bedevere-app

bedevere-app Bot commented Jun 6, 2025

Copy link
Copy Markdown

When you're done making the requested changes, leave the comment: I have made the requested changes; please review again.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

pablogsal added 2 commits June 7, 2025 02:06
@pablogsal
Address review
fdc81d6
@pablogsal
Fix linting
3c86cce
lysnikolaou
lysnikolaou reviewed Jun 9, 2025
View reviewed changes

@lysnikolaou lysnikolaou left a comment •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

This looks good now! Thanks @pablogsal!

I left a couple of inline comments for some very minor improvements.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Parser/lexer/lexer.c
Comment on lines +141 to +147
if (!in_string) {
in_string = 1;
quote_char = ch;
}
else if (ch == quote_char) {
in_string = 0;
}

@lysnikolaou lysnikolaou Jun 9, 2025

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

This only works because there's always an odd number of quotes in a STRING token and we're sure that all STRING tokens will be valid at this point. Maybe add a comment to explain that?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Parser/lexer/lexer.c Outdated
Comment on lines +127 to +128
char quote_char = 0;
char string_quote = 0;

@lysnikolaou lysnikolaou Jun 9, 2025

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Do we need both of these?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@lysnikolaou

lysnikolaou commented Jul 13, 2025

Copy link
Copy Markdown
Member

@pablogsal Ping here. Will we be able to get thins into 3.13 before the rc release? If you don't have time to work on it, I'm okay taking it over.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@pablogsal

pablogsal commented Jul 13, 2025

Copy link
Copy Markdown
Member Author

I am travelling today :( If you want and have the time you can push the fixes to the PR and land it but if you don't have time maybe I can get to it at night.

lysnikolaou reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@lysnikolaou
Add comment and remove unnecessary variable
e736c99
lysnikolaou
lysnikolaou approved these changes Jul 16, 2025
View reviewed changes

@lysnikolaou lysnikolaou left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Pushed a commit with a couple of additions. LGTM now! Let's merge it.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting changes labels Jul 16, 2025
@pablogsal
pablogsal merged commit ef66fb5 into python:main Jul 16, 2025
@pablogsal
pablogsal deleted the gh-135148 branch July 16, 2025 09:47
@bedevere-app bedevere-app Bot removed the awaiting merge label Jul 16, 2025
@lysnikolaou

lysnikolaou commented Jul 16, 2025

Copy link
Copy Markdown
Member

Are we backporting this?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@pablogsal

pablogsal commented Jul 16, 2025

Copy link
Copy Markdown
Member Author

We should indeed

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@pablogsal pablogsal added needs backport to 3.13 only security fixes needs backport to 3.14 bugs and security fixes labels Jul 16, 2025
@miss-islington-app

miss-islington-app Bot commented Jul 16, 2025

Copy link
Copy Markdown

Thanks @pablogsal for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13.
🐍🍒⛏🤖

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@miss-islington-app

miss-islington-app Bot commented Jul 16, 2025

Copy link
Copy Markdown

Thanks @pablogsal for the PR 🌮🎉.. I'm working now to backport this PR to: 3.14.
🐍🍒⛏🤖

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@miss-islington-app

miss-islington-app Bot commented Jul 16, 2025

Copy link
Copy Markdown

Sorry, @pablogsal, I could not cleanly backport this to 3.13 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker ef66fb597ba909ead2fbfc06f748aa7b7e9ea437 3.13
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@miss-islington-app miss-islington-app Bot assigned pablogsal Jul 16, 2025
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jul 16, 2025
@pablogsal @miss-islington
pythongh-135148: Correctly handle f/t strings with comments and debug…
c08f2ab
… expressions (pythonGH-135198)

(cherry picked from commit ef66fb5)

Co-authored-by: Pablo Galindo Salgado <[email protected]>
@bedevere-app

bedevere-app Bot commented Jul 16, 2025

Copy link
Copy Markdown

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label Jul 16, 2025
pablogsal pushed a commit that referenced this pull request Jul 16, 2025
@miss-islington
[3.14] gh-135148: Correctly handle f/t strings with comments and debu…
9bf3464
…g expressions (GH-135198) (#136720)
@bedevere-app

bedevere-app Bot commented Jul 21, 2025

Copy link
Copy Markdown

GH-136899 is a backport of this pull request to the 3.13 branch.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the needs backport to 3.13 only security fixes label Jul 21, 2025
lysnikolaou added a commit that referenced this pull request Jul 21, 2025
@lysnikolaou @pablogsal
[3.13] gh-135148: Correctly handle f/t strings with comments and debu…
c1085a0
…g expressions (#135198) (#136899)

Co-authored-by: Pablo Galindo Salgado <[email protected]>
taegyunkim pushed a commit to taegyunkim/cpython that referenced this pull request Aug 4, 2025
@pablogsal @taegyunkim
pythongh-135148: Correctly handle f/t strings with comments and debug…
941dba0
… expressions (python#135198)
Agent-Hellboy pushed a commit to Agent-Hellboy/cpython that referenced this pull request Aug 19, 2025
@pablogsal @Agent-Hellboy
pythongh-135148: Correctly handle f/t strings with comments and debug…
a2fad4c
… expressions (python#135198)
kumaraditya303 pushed a commit to miss-islington/cpython that referenced this pull request Sep 9, 2025
@miss-islington @kumaraditya303
[3.14] pythongh-135148: Correctly handle f/t strings with comments an…
f671b96
…d debug expressions (pythonGH-135198) (python#136720)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@lysnikolaou lysnikolaou lysnikolaou approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@pablogsal pablogsal

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@pablogsal @lysnikolaou
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.