KEMBAR78
gh-133197: Improve error message for `ft""` and `bt""` cases by sobolevn · Pull Request #133202 · python/cpython · GitHub
Skip to content

Conversation

@sobolevn
Copy link
Member

@sobolevn sobolevn commented Apr 30, 2025

@sobolevn
Copy link
Member Author

Hm, looks like other string prefixes can also conflict with no clear message. Examples:

>>> tb''
  File "<python-input-3>", line 1
    tb''
      ^^
SyntaxError: invalid syntax

>>> fb''
  File "<python-input-0>", line 1
    fb''
      ^^
SyntaxError: invalid syntax

>>> ru''
  File "<python-input-1>", line 1
    ru''
      ^^
SyntaxError: invalid syntax

>>> bu''
  File "<python-input-2>", line 1
    bu''
      ^^
SyntaxError: invalid syntax

Let's handle all t cases here maybe and u-string prefixes in the next PR? It would much easier for me.

@sobolevn sobolevn changed the title gh-133196: Improve error message for ft"" case gh-133196: Improve error message for ft"" and bt"" cases Apr 30, 2025
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.

Left a couple of comments inline. Also, it appears that the issue number is wrong. Could you change it please?

@sobolevn
Copy link
Member Author

Now we have prefixes highlighted:
Снимок экрана 2025-04-30 в 15 19 42
Снимок экрана 2025-04-30 в 15 19 12

@sobolevn sobolevn changed the title gh-133196: Improve error message for ft"" and bt"" cases gh-133197: Improve error message for ft"" and bt"" cases Apr 30, 2025
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! This is a nice improvement! Let's follow up with the rest of the prefixes.

@sobolevn sobolevn merged commit b451516 into python:main Apr 30, 2025
45 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants