diff options
| author | Torsten Marek <tmarek@google.com> | 2013-06-17 19:16:42 +0200 |
|---|---|---|
| committer | Torsten Marek <tmarek@google.com> | 2013-06-17 19:16:42 +0200 |
| commit | 1d83a1c9f6747568d26349bbd8d74b942dbef766 (patch) | |
| tree | 65e8e1825bf56aa0a4cb58ed847b436896163d0a /lint.py | |
| parent | 34e999fc8d56fdeadda39bb8f7122e203af7d869 (diff) | |
| download | pylint-1d83a1c9f6747568d26349bbd8d74b942dbef766.tar.gz | |
The tokenize module rejects certain source files that are accepted as
valid by the Python interpreter, e.g. modules that end with a line
continuation. Catch the exception and skip the files.
Diffstat (limited to 'lint.py')
| -rw-r--r-- | lint.py | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -649,7 +649,11 @@ This is used by the global evaluation report (RP0004).'}), def check_astroid_module(self, astroid, walker, rawcheckers, tokencheckers): """check a module from its astroid representation, real work""" # call raw checkers if possible - tokens = tokenize_module(astroid) + try: + tokens = tokenize_module(astroid) + except tokenize.TokenError, ex: + self.add_message('E0001', line=ex.args[1][0], args=ex.args[0]) + return if not astroid.pure_python: self.add_message('I0001', args=astroid.name) |
