Skip to content

gh-133197: Improve error message for ft"" and bt"" cases #133202

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 4 commits into from
Apr 30, 2025

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