bpo-40619: Correctly handle error lines in programs without file mode (GH-20090)

diff --git a/Lib/test/test_exceptions.py b/Lib/test/test_exceptions.py
index b689ec7..efd77fd 100644
--- a/Lib/test/test_exceptions.py
+++ b/Lib/test/test_exceptions.py
@@ -228,6 +228,8 @@
             def baz():
                 '''quux'''
             """, 9, 20)
+        check("pass\npass\npass\n(1+)\npass\npass\npass", 4, 4)
+        check("(1+)", 1, 4)
 
         # Errors thrown by symtable.c
         check('x = [(yield i) for i in range(3)]', 1, 5)