diff options
author | Mariatta <Mariatta@users.noreply.github.com> | 2017-04-20 05:59:20 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-20 05:59:20 (GMT) |
commit | 58f3c9dc8f5626abe09ac9738c34f6ba99ce2972 (patch) | |
tree | 290697b9a9bedc1bd5bcf14334a7798d716d09df /Tools/scripts/reindent.py | |
parent | 6dbdedb0b18a5ca850ab8ce512fda24d5a9d0688 (diff) | |
download | cpython-58f3c9dc8f5626abe09ac9738c34f6ba99ce2972.zip cpython-58f3c9dc8f5626abe09ac9738c34f6ba99ce2972.tar.gz cpython-58f3c9dc8f5626abe09ac9738c34f6ba99ce2972.tar.bz2 |
bpo-30109: Fix reindent.py (GH-1207)
Skip the file if it has bad encoding.
Diffstat (limited to 'Tools/scripts/reindent.py')
-rwxr-xr-x | Tools/scripts/reindent.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Tools/scripts/reindent.py b/Tools/scripts/reindent.py index 18424de..f6dadaa 100755 --- a/Tools/scripts/reindent.py +++ b/Tools/scripts/reindent.py @@ -118,7 +118,11 @@ def check(file): if verbose: print("checking", file, "...", end=' ') with open(file, 'rb') as f: - encoding, _ = tokenize.detect_encoding(f.readline) + try: + encoding, _ = tokenize.detect_encoding(f.readline) + except SyntaxError as se: + errprint("%s: SyntaxError: %s" % (file, str(se))) + return try: with open(file, encoding=encoding) as f: r = Reindenter(f) |