From f4b814f9a23287716493a612e041f7cd4ea297ac Mon Sep 17 00:00:00 2001 From: "Miss Islington (bot)" <31488909+miss-islington@users.noreply.github.com> Date: Tue, 12 Dec 2017 10:29:05 -0800 Subject: [PATCH] Fix improper use of re.escape() in tests. (GH-4814) (#4816) (cherry picked from commit b748e3b2586e44bfc7011b601bce9cc6d16d89f1) --- Lib/test/test_re.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/test/test_re.py b/Lib/test/test_re.py index e23e5a9a6ca..2b74373ffae 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')