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
bpo-32603: Deprecation warning on strings used in re module #5255
Conversation
4ec44c2
to
9c95baf
Compare
Doc/library/re.rst
Outdated
is complicated and hard to understand, so it's highly recommended that you use | ||
raw strings for all but the simplest expressions. | ||
sequence isn't recognized by Python's parser, it will generate a | ||
:exc:`DeprecationWarning` and in the future this will become a :exc:`Syntaxerror`. |
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.
Syntaxerror -> SyntaxError
IMHO, I actually thought the warning about the DeprecationWarning and SyntaxError should come in one of the introduction paragraphs since the raw strings are discussed there. In the paragraph that starts with, |
Thank you very much @csabella. I have added some lines as you suggested in the introductory paragraphs. |
Doc/library/re.rst
Outdated
@@ -28,7 +28,10 @@ character for the same purpose in string literals; for example, to match | |||
a literal backslash, one might have to write ``'\\\\'`` as the pattern | |||
string, because the regular expression must be ``\\``, and each | |||
backslash must be expressed as ``\\`` inside a regular Python string | |||
literal. | |||
literal. Also, please note that any invalid escape sequences in Python's | |||
usage of the backslash in string literals now generate a DeprecationWarning |
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.
Could you use a link to the DeprecationWarning exception like that
:exc:`DeprecationWarning`
same for the SyntaxError exception
cded1bd
to
85c4cf9
Compare
…s in the re module
CC: @JulienPalard |
https://bugs.python.org/issue32603