]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Add information about DeprecationWarning for invalid escaped characters in the re...
authorPablo Galindo <Pablogsal@gmail.com>
Sun, 20 Jan 2019 18:57:56 +0000 (18:57 +0000)
committerGitHub <noreply@github.com>
Sun, 20 Jan 2019 18:57:56 +0000 (18:57 +0000)
Doc/library/re.rst

index 2f829559ff174a1186bb33ef846f87ab1c58131f..ac6455a22074d305e21bc1766ecc38f1f933098d 100644 (file)
@@ -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 :exc:`DeprecationWarning`
+and in the future this will become a :exc:`SyntaxError`. This behaviour
+will happen even if it is a valid escape sequence for a regular expression.
 
 The solution is to use Python's raw string notation for regular expression
 patterns; backslashes are not handled in any special way in a string literal