summaryrefslogtreecommitdiffstats
path: root/Parser/asdl.py
diff options
context:
space:
mode:
authorEli Bendersky <eliben@gmail.com>2013-09-26 13:41:36 (GMT)
committerEli Bendersky <eliben@gmail.com>2013-09-26 13:41:36 (GMT)
commit99081238e91261c74a1534988e250235f72d8d0f (patch)
tree6d7add55f7456e0b77dd33c70e46c09a907b859c /Parser/asdl.py
parent58fe1b1307141c96ac4657e336431f73e5f1d92f (diff)
downloadcpython-99081238e91261c74a1534988e250235f72d8d0f.zip
cpython-99081238e91261c74a1534988e250235f72d8d0f.tar.gz
cpython-99081238e91261c74a1534988e250235f72d8d0f.tar.bz2
Don't use fancy new Python features like 'with' - some bots don't have them
and can't bootstrap the parser.
Diffstat (limited to 'Parser/asdl.py')
-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)