mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
prevert ast errors from being normalized before ast_error_finish is called (closes #15846)
This commit is contained in:
parent
1c371b255f
commit
2e2c903700
3 changed files with 17 additions and 0 deletions
|
@ -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),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue