]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.7] bpo-38294: Add list of no-longer-escaped chars to re.escape documentation....
authorRicardo Bánffy <rbanffy@gmail.com>
Tue, 8 Oct 2019 16:41:00 +0000 (17:41 +0100)
committerNed Deily <nad@python.org>
Mon, 14 Oct 2019 21:00:49 +0000 (17:00 -0400)
Prior to 3.7, re.escape escaped many characters that don't have
special meaning in Python, but that use to require escaping in other
tools and languages. This commit aims to make it clear which characters
were, but are no longer escaped.
(cherry picked from commit 15ae75d660befe643ed42eb2707a557cea97256c)

Doc/library/re.rst
Doc/tools/susp-ignored.csv
Misc/NEWS.d/next/Documentation/2019-09-27-23-37-41.bpo-38294.go_jFf.rst [new file with mode: 0644]

index a23e45f2eb52f973522b0dc5537bc3ac30ca35b2..4245c2417fee67dc75e5cfb42486837b37b6bcab 100644 (file)
@@ -925,8 +925,8 @@ form.
    This is useful if you want to match an arbitrary literal string that may
    have regular expression metacharacters in it.  For example::
 
-      >>> print(re.escape('python.exe'))
-      python\.exe
+      >>> print(re.escape('http://www.python.org'))
+      http://www\.python\.org
 
       >>> legal_chars = string.ascii_lowercase + string.digits + "!#$%&'*+-.^_`|~:"
       >>> print('[%s]+' % re.escape(legal_chars))
@@ -949,7 +949,9 @@ form.
 
    .. versionchanged:: 3.7
       Only characters that can have special meaning in a regular expression
-      are escaped.
+      are escaped. As a result, ``'!'``, ``'"'``, ``'%'``, ``"'"``, ``','``,
+      ``'/'``, ``':'``, ``';'``, ``'<'``, ``'='``, ``'>'``, ``'@'``, and
+      ``"`"`` are no longer escaped.
 
 
 .. function:: purge()
index 35dfce2c5c80e74de3ccf3baa8c22192e05bb019..36d93a45b0209e884a592b49423f4666e2b6b9f6 100644 (file)
@@ -354,3 +354,4 @@ whatsnew/3.7,,::,error::BytesWarning
 whatsnew/changelog,,::,error::BytesWarning
 whatsnew/changelog,,::,default::BytesWarning
 whatsnew/changelog,,::,default::DeprecationWarning
+library/re,,`,"`"
diff --git a/Misc/NEWS.d/next/Documentation/2019-09-27-23-37-41.bpo-38294.go_jFf.rst b/Misc/NEWS.d/next/Documentation/2019-09-27-23-37-41.bpo-38294.go_jFf.rst
new file mode 100644 (file)
index 0000000..0bde8c8
--- /dev/null
@@ -0,0 +1 @@
+Add list of no-longer-escaped chars to re.escape documentation
\ No newline at end of file