[3.10] bpo-45727: Only trigger the 'did you forgot a comma' error suggestion if inside parentheses. (GH-29767)

Backport of GH-29757

Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
diff --git a/Lib/test/test_fstring.py b/Lib/test/test_fstring.py
index 14a4c67..bd1ca94 100644
--- a/Lib/test/test_fstring.py
+++ b/Lib/test/test_fstring.py
@@ -944,7 +944,7 @@ def test_invalid_string_prefixes(self):
                              "Bf''",
                              "BF''",]
         double_quote_cases = [case.replace("'", '"') for case in single_quote_cases]
-        self.assertAllRaise(SyntaxError, 'unexpected EOF while parsing',
+        self.assertAllRaise(SyntaxError, 'invalid syntax',
                             single_quote_cases + double_quote_cases)
 
     def test_leading_trailing_spaces(self):