-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
gh-128016: Improved invalid escape sequence warning message #128020
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
Conversation
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
@vstinner How long does it usually take for a PR like this to get merged? |
There is no rule. It depends. |
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.
LGTM.
This PR improves the warning shown when using an invalid escape sequence by revising it from
SyntaxWarning: invalid escape sequence '\W'
to"\W" is an invalid escape sequence. Such sequences will not work in the future. Did you mean "\\W"? A raw string is also an option.
as proposed in #128016.The purpose is to:
Hello\n World and\or fizz buzz
), as suggested by @hugovk.At present, speaking from my own experience, the current message does not communicate very clearly the urgent need to cease using invalid escapes lest you create code that will end up broken and also educate on how to quickly fix the issue.
SyntaxWarning
for invalid escape sequences better reflect their intended deprecation #128016