Don't use fancy new Python features like 'with' - some bots don't have them
and can't bootstrap the parser.
This commit is contained in:
parent
58fe1b1307
commit
99081238e9
|
@ -398,8 +398,11 @@ def parse(file):
|
||||||
scanner = ASDLScanner()
|
scanner = ASDLScanner()
|
||||||
parser = ASDLParser()
|
parser = ASDLParser()
|
||||||
|
|
||||||
with open(file) as f:
|
try:
|
||||||
|
f = open(file)
|
||||||
buf = f.read()
|
buf = f.read()
|
||||||
|
finally:
|
||||||
|
f.close()
|
||||||
tokens = scanner.tokenize(buf)
|
tokens = scanner.tokenize(buf)
|
||||||
try:
|
try:
|
||||||
return parser.parse(tokens)
|
return parser.parse(tokens)
|
||||||
|
|
Loading…
Reference in New Issue