Don't use fancy new Python features like 'with' - some bots don't have them
authorEli Bendersky <eliben@gmail.com>
Thu, 26 Sep 2013 13:41:36 +0000 (06:41 -0700)
committerEli Bendersky <eliben@gmail.com>
Thu, 26 Sep 2013 13:41:36 +0000 (06:41 -0700)
and can't bootstrap the parser.

Parser/asdl.py

index 1651e7f61d59c67d635f593a9b4487ba6a0ac9d9..be02d9c4d60323a55d2f9f5aa54fa82d4bf0519e 100644 (file)
@@ -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)