prevert ast errors from being normalized before ast_error_finish is called (closes #15846)

This commit is contained in:
Benjamin Peterson 2012-09-02 14:23:15 -04:00
parent 1c371b255f
commit 2e2c903700
3 changed files with 17 additions and 0 deletions

View file

@ -386,6 +386,12 @@ class ASTHelpers_Test(unittest.TestCase):
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),