diff options
| author | Eric N. Vander Weele <ericvw@gmail.com> | 2020-06-02 09:40:12 -0400 |
|---|---|---|
| committer | Anthony Sottile <asottile@umich.edu> | 2020-06-02 11:38:44 -0700 |
| commit | a68d4d01722bfbf0ec2179383acc13a7d87eb499 (patch) | |
| tree | d10609cc0db0b3bbca7ba1ca4af3c3dc47df25eb /src | |
| parent | 40716454a285b7a3f63c398f78106fafd5c668e7 (diff) | |
| download | flake8-a68d4d01722bfbf0ec2179383acc13a7d87eb499.tar.gz | |
processor: Catch SyntaxError also when generating tokens for a file
`tokenize.generate_tokens()` can also raise `SyntaxError` in addition to
`tokenize.TokenError`.
Diffstat (limited to 'src')
| -rw-r--r-- | src/flake8/processor.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/flake8/processor.py b/src/flake8/processor.py index 0375ed9..b675c99 100644 --- a/src/flake8/processor.py +++ b/src/flake8/processor.py @@ -125,7 +125,7 @@ class FileProcessor(object): self._file_tokens = list( tokenize.generate_tokens(lambda: next(line_iter)) ) - except tokenize.TokenError as exc: + except (tokenize.TokenError, SyntaxError) as exc: raise exceptions.InvalidSyntax(exception=exc) return self._file_tokens |
