[Python-checkins] [3.12] gh-105915: Add 'r' prefix to not emit SyntaxWarning in test_fstring (GH-105940) (#105942)

lysnikolaou webhook-mailer at python.org
Tue Jun 20 09:16:25 EDT 2023


https://github.com/python/cpython/commit/164fa930011c46d3261538c17f8c4ffbeedc0f7e
commit: 164fa930011c46d3261538c17f8c4ffbeedc0f7e
branch: 3.12
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: lysnikolaou <lisandrosnik at gmail.com>
date: 2023-06-20T13:16:21Z
summary:

[3.12] gh-105915: Add 'r' prefix to not emit SyntaxWarning in test_fstring (GH-105940) (#105942)

(cherry picked from commit 4b431d2e90bf5760a57aa40af2dd78e7bbf0b1ae)

Co-authored-by: @sunmy2019
Co-authored-by: Lysandros Nikolaou <lisandrosnik at gmail.com>

files:
M Lib/test/test_fstring.py

diff --git a/Lib/test/test_fstring.py b/Lib/test/test_fstring.py
index ad5ac6a2f043..1eb3bfb41888 100644
--- a/Lib/test/test_fstring.py
+++ b/Lib/test/test_fstring.py
@@ -773,7 +773,7 @@ def __format__(self, format_spec):
         self.assertEqual(f'{CustomFormat():\n}', '\n')
         self.assertEqual(f'{CustomFormat():\u2603}', '☃')
         with self.assertWarns(SyntaxWarning):
-            exec('f"{F():¯\_(ツ)_/¯}"', {'F': CustomFormat})
+            exec(r'f"{F():¯\_(ツ)_/¯}"', {'F': CustomFormat})
 
     def test_side_effect_order(self):
         class X:



More information about the Python-checkins mailing list