bpo-42864: Improve error messages regarding unclosed parentheses (GH-24161)

diff --git a/Lib/test/test_codeop.py b/Lib/test/test_codeop.py
index 45d0a7d..1da6ca5 100644
--- a/Lib/test/test_codeop.py
+++ b/Lib/test/test_codeop.py
@@ -160,7 +160,6 @@ def test_incomplete(self):
         ai("","eval")
         ai("\n","eval")
         ai("(","eval")
-        ai("(\n\n\n","eval")
         ai("(9+","eval")
         ai("9+ \\","eval")
         ai("lambda z: \\","eval")
diff --git a/Lib/test/test_grammar.py b/Lib/test/test_grammar.py
index 2f6716d..0be869e 100644
--- a/Lib/test/test_grammar.py
+++ b/Lib/test/test_grammar.py
@@ -260,7 +260,7 @@ def test_eof_error(self):
         for s in samples:
             with self.assertRaises(SyntaxError) as cm:
                 compile(s, "<test>", "exec")
-            self.assertIn("unexpected EOF", str(cm.exception))
+            self.assertIn("was never closed", str(cm.exception))
 
 var_annot_global: int # a global annotated is necessary for test_var_annot
 
diff --git a/Lib/test/test_pdb.py b/Lib/test/test_pdb.py
index 4bb574f..93b61dc 100644
--- a/Lib/test/test_pdb.py
+++ b/Lib/test/test_pdb.py
@@ -1649,10 +1649,10 @@ def test_errors_in_command(self):
 
         self.assertEqual(stdout.splitlines()[1:], [
             '-> pass',
-            '(Pdb) *** SyntaxError: unexpected EOF while parsing',
+            '(Pdb) *** SyntaxError: \'(\' was never closed',
 
             '(Pdb) ENTERING RECURSIVE DEBUGGER',
-            '*** SyntaxError: unexpected EOF while parsing',
+            '*** SyntaxError: \'(\' was never closed',
             'LEAVING RECURSIVE DEBUGGER',
 
             '(Pdb) ENTERING RECURSIVE DEBUGGER',
diff --git a/Lib/test/test_syntax.py b/Lib/test/test_syntax.py
index d825560..c8d191d 100644
--- a/Lib/test/test_syntax.py
+++ b/Lib/test/test_syntax.py
@@ -987,6 +987,14 @@ def test_invalid_line_continuation_left_recursive(self):
         self._check_error("A.\u03bc\\\n",
                           "unexpected EOF while parsing")
 
+    def test_error_parenthesis(self):
+        for paren in "([{":
+            self._check_error(paren + "1 + 2", f"\\{paren}' was never closed")
+
+        for paren in ")]}":
+            self._check_error(paren + "1 + 2", f"unmatched '\\{paren}'")
+
+
 def test_main():
     support.run_unittest(SyntaxTestCase)
     from test import test_syntax