summaryrefslogtreecommitdiffstats
path: root/Lib/sre_parse.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2016-12-06 17:15:29 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2016-12-06 17:15:29 (GMT)
commit53c53ea4c5440593a527bf3d106b5f7feebeed40 (patch)
treef02e42b90c60a91a4eabbc08d748704785288dd8 /Lib/sre_parse.py
parentb0f75c520ee882295b0d2884469056ebf0d0568b (diff)
downloadcpython-53c53ea4c5440593a527bf3d106b5f7feebeed40.zip
cpython-53c53ea4c5440593a527bf3d106b5f7feebeed40.tar.gz
cpython-53c53ea4c5440593a527bf3d106b5f7feebeed40.tar.bz2
Issue #27030: Unknown escapes in re.sub() replacement template are allowed
again. But they still are deprecated and will be disabled in 3.7.
Diffstat (limited to 'Lib/sre_parse.py')
-rw-r--r--Lib/sre_parse.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/sre_parse.py b/Lib/sre_parse.py
index ab37fd3..6aa49c3 100644
--- a/Lib/sre_parse.py
+++ b/Lib/sre_parse.py
@@ -947,7 +947,9 @@ def parse_template(source, pattern):
this = chr(ESCAPES[this][1])
except KeyError:
if c in ASCIILETTERS:
- raise s.error('bad escape %s' % this, len(this))
+ import warnings
+ warnings.warn('bad escape %s' % this,
+ DeprecationWarning, stacklevel=4)
lappend(this)
else:
lappend(this)