https://github.com/python/cpython/commit/5bcb476df1127bffcad8f37141d8140221a7b43b
commit: 5bcb476df1127bffcad8f37141d8140221a7b43b
branch: 3.13
author: Brian Schubert <[email protected]>
committer: vstinner <[email protected]>
date: 2025-03-26T17:31:59+01:00
summary:

[3.13] gh-131649: fix test_string_literals SyntaxWarning (GH-131650) (#131766)

(cherry picked from commit 2d83891dfd51f595de68b0336b3bfc876f7b2507)

Co-authored-by: Thomas Grainger <[email protected]>

files:
M Lib/test/test_string_literals.py

diff --git a/Lib/test/test_string_literals.py b/Lib/test/test_string_literals.py
index 3d793427c9ab5d..849efaba6180f7 100644
--- a/Lib/test/test_string_literals.py
+++ b/Lib/test/test_string_literals.py
@@ -172,7 +172,7 @@ def test_invalid_escape_locations_with_offset(self):
         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 @@ def test_invalid_escape_locations_with_offset(self):
         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 '\ '")

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]

Reply via email to