From e8d0ecf38ffc6af5bd7cb5a61bbaf7ba121d5004 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Mon, 19 Sep 2016 12:55:52 -0700 Subject: [PATCH] Skip files with syntax errors --- pep-0505/find-pep505.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pep-0505/find-pep505.py b/pep-0505/find-pep505.py index 0224ff8c0..828e98715 100644 --- a/pep-0505/find-pep505.py +++ b/pep-0505/find-pep505.py @@ -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)