summaryrefslogtreecommitdiffstats
path: root/Parser
diff options
context:
space:
mode:
Diffstat (limited to 'Parser')
-rw-r--r--Parser/asdl.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/Parser/asdl.py b/Parser/asdl.py
index 1651e7f..be02d9c 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)