diff options
| author | Ian Cordasco <graffatcolmingov@gmail.com> | 2016-08-27 19:53:14 -0500 |
|---|---|---|
| committer | Ian Cordasco <graffatcolmingov@gmail.com> | 2016-08-27 19:53:14 -0500 |
| commit | 585628875d29f4a46d8adbccc0e1bfa7b3a4a347 (patch) | |
| tree | 48f43f73f87014d9e5c5c5df3b15456734b4d79c /src/flake8 | |
| parent | 1631ab8ac719d1c2ab39df1bc8c41028683ef23e (diff) | |
| download | flake8-585628875d29f4a46d8adbccc0e1bfa7b3a4a347.tar.gz | |
Ensure column_number is always an integer
When a SyntaxError is raised, column_number may be None. Unfortunately,
it's not obvious where that None comes from so we must handle it in
handle_error.
Closes #214
Diffstat (limited to 'src/flake8')
| -rw-r--r-- | src/flake8/style_guide.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/flake8/style_guide.py b/src/flake8/style_guide.py index a1ab473..4d8950c 100644 --- a/src/flake8/style_guide.py +++ b/src/flake8/style_guide.py @@ -253,7 +253,10 @@ class StyleGuide(object): int """ # NOTE(sigmavirus24): Apparently we're provided with 0-indexed column - # numbers so we have to offset that here. + # numbers so we have to offset that here. Also, if a SyntaxError is + # caught, column_number may be None. + if not column_number: + column_number = 0 error = Error(code, filename, line_number, column_number + 1, text, physical_line) error_is_selected = (self.should_report_error(error.code) is |
