diff --git a/Lib/test/test_re.py b/Lib/test/test_re.py index 2344d71abf2..aaed3d893aa 100644 --- a/Lib/test/test_re.py +++ b/Lib/test/test_re.py @@ -109,7 +109,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')