diff --git a/Parser/asdl.py b/Parser/asdl.py index 1651e7f61d5..be02d9c4d60 100644 --- a/Parser/asdl.py +++ b/Parser/asdl.py @@ -398,8 +398,11 @@ def parse(file): scanner = ASDLScanner() parser = ASDLParser() - with open(file) as f: + try: + f = open(file) buf = f.read() + finally: + f.close() tokens = scanner.tokenize(buf) try: return parser.parse(tokens)