Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bd0df50

Browse files
committed
get rid of ast_error_finish by passing the compiling struct to ast_error
1 parent e9f72db commit bd0df50

2 files changed

Lines changed: 75 additions & 119 deletions

File tree

Lib/test/test_ast.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,9 @@ def test_parse_in_error(self):
411411
try:
412412
1/0
413413
except Exception:
414-
self.assertRaises(SyntaxError, ast.parse, r"'\U'")
414+
with self.assertRaises(SyntaxError) as e:
415+
ast.literal_eval(r"'\U'")
416+
self.assertIsNotNone(e.exception.__context__)
415417

416418
def test_dump(self):
417419
node = ast.parse('spam(eggs, "and cheese")')

0 commit comments

Comments
 (0)