From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Wed, 26 Mar 2025 16:47:55 +0000 (+0100) Subject: [3.12] gh-131649: fix test_string_literals SyntaxWarning (GH-131650) (GH-131766)... X-Git-Tag: v3.12.10~58 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1826347d9d0553a4aab67195c001ef944977cddb;p=thirdparty%2FPython%2Fcpython.git [3.12] gh-131649: fix test_string_literals SyntaxWarning (GH-131650) (GH-131766) (#131772) [3.13] gh-131649: fix test_string_literals SyntaxWarning (GH-131650) (GH-131766) (cherry picked from commit 2d83891dfd51f595de68b0336b3bfc876f7b2507) (cherry picked from commit 5bcb476df1127bffcad8f37141d8140221a7b43b) Co-authored-by: Brian Schubert Co-authored-by: Thomas Grainger --- diff --git a/Lib/test/test_string_literals.py b/Lib/test/test_string_literals.py index 3d793427c9ab..849efaba6180 100644 --- a/Lib/test/test_string_literals.py +++ b/Lib/test/test_string_literals.py @@ -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 '\ '")