prevert ast errors from being normalized before ast_error_finish is called (closes #15846)
diff --git a/Lib/test/test_ast.py b/Lib/test/test_ast.py
index e22d4de..2887092 100644
--- a/Lib/test/test_ast.py
+++ b/Lib/test/test_ast.py
@@ -386,6 +386,12 @@
b = compile('foo(1 + 1)', '<unknown>', 'exec', ast.PyCF_ONLY_AST)
self.assertEqual(ast.dump(a), ast.dump(b))
+ def test_parse_in_error(self):
+ try:
+ 1/0
+ except Exception:
+ self.assertRaises(SyntaxError, ast.parse, r"'\U'")
+
def test_dump(self):
node = ast.parse('spam(eggs, "and cheese")')
self.assertEqual(ast.dump(node),