Skip files with syntax errors

This commit is contained in:
Guido van Rossum 2016-09-19 12:55:52 -07:00
parent 2a4515c429
commit e8d0ecf38f
1 changed files with 4 additions and 1 deletions

View File

@ -402,7 +402,10 @@ def main():
for file_ in sys.argv[1:]:
with open(file_) as source:
tree = ast.parse(source.read(), filename=file_)
try:
tree = ast.parse(source.read(), filename=file_)
except SyntaxError:
continue
NoneCoalesceIfBlockVisitor(file_, nci_callback).visit(tree)
NoneCoalesceOrVisitor(file_, nco_callback).visit(tree)