From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Date: Tue, 12 Dec 2017 18:29:05 +0000 (-0800)
Subject: Fix improper use of re.escape() in tests. (GH-4814) (#4816)
X-Git-Tag: v3.6.5rc1~212
X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f4b814f9a23287716493a612e041f7cd4ea297ac;p=thirdparty%2FPython%2Fcpython.git
Fix improper use of re.escape() in tests. (GH-4814) (#4816)
(cherry picked from commit b748e3b2586e44bfc7011b601bce9cc6d16d89f1)
---
diff --git a/Lib/test/test_re.py b/Lib/test/test_re.py
index e23e5a9a6caf..2b74373ffae9 100644
--- a/Lib/test/test_re.py
+++ b/Lib/test/test_re.py
@@ -112,7 +112,7 @@ class ReTests(unittest.TestCase):
s = r"\1\1"
self.assertEqual(re.sub('(.)', s, 'x'), 'xx')
- self.assertEqual(re.sub('(.)', re.escape(s), 'x'), s)
+ self.assertEqual(re.sub('(.)', s.replace('\\', r'\\'), 'x'), s)
self.assertEqual(re.sub('(.)', lambda m: s, 'x'), s)
self.assertEqual(re.sub('(?Px)', r'\g\g', 'xx'), 'xxxx')