]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] gh-131649: fix test_string_literals SyntaxWarning (GH-131650) (#131766)
authorBrian Schubert <brianm.schubert@gmail.com>
Wed, 26 Mar 2025 16:31:59 +0000 (12:31 -0400)
committerGitHub <noreply@github.com>
Wed, 26 Mar 2025 16:31:59 +0000 (17:31 +0100)
(cherry picked from commit 2d83891dfd51f595de68b0336b3bfc876f7b2507)

Co-authored-by: Thomas Grainger <tagrain@gmail.com>
Lib/test/test_string_literals.py

index 3d793427c9ab5d758e8bb386a1574aa54422b9d4..849efaba6180f7fa05f71442253982279c6423ed 100644 (file)
@@ -172,7 +172,7 @@ class TestLiterals(unittest.TestCase):
         with warnings.catch_warnings(record=True) as w:
             warnings.simplefilter('error', category=SyntaxWarning)
             with self.assertRaises(SyntaxError) as cm:
-                eval("\"'''''''''''''''''''''invalid\ Escape\"")
+                eval("\"'''''''''''''''''''''invalid\\ Escape\"")
             exc = cm.exception
         self.assertEqual(w, [])
         self.assertEqual(exc.msg, r"invalid escape sequence '\ '")
@@ -183,7 +183,7 @@ class TestLiterals(unittest.TestCase):
         with warnings.catch_warnings(record=True) as w:
             warnings.simplefilter('error', category=SyntaxWarning)
             with self.assertRaises(SyntaxError) as cm:
-                eval("\"''Incorrect \ logic?\"")
+                eval("\"''Incorrect \\ logic?\"")
             exc = cm.exception
         self.assertEqual(w, [])
         self.assertEqual(exc.msg, r"invalid escape sequence '\ '")