aboutsummaryrefslogtreecommitdiff
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 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)