summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorent Xicluna <florent.xicluna@gmail.com>2013-02-13 08:58:56 +0100
committerFlorent Xicluna <florent.xicluna@gmail.com>2013-02-13 08:58:56 +0100
commit9dfb34e7d833c9a417a28737425de7cd34f59186 (patch)
tree6292c1b774bc779ff2431f24a6bf03249110a55f
parent030ac6e3c7a3cf09209d2bb3afeb560a530f0c06 (diff)
downloadpep8-9dfb34e7d833c9a417a28737425de7cd34f59186.tar.gz
Fix crash with AST checkers when the syntax is invalid. Issue #160
-rw-r--r--CHANGES.txt2
-rwxr-xr-xpep8.py2
2 files changed, 3 insertions, 1 deletions
diff --git a/CHANGES.txt b/CHANGES.txt
index 84c92af..a2decfb 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -7,6 +7,8 @@ Changelog
* Hide the ``--doctest`` and ``--testsuite`` options when installed.
+* Fix crash with AST checkers when the syntax is invalid. (Issue #160)
+
1.4.2 (2013-02-10)
------------------
diff --git a/pep8.py b/pep8.py
index 2aa0034..23de741 100755
--- a/pep8.py
+++ b/pep8.py
@@ -1221,7 +1221,7 @@ class Checker(object):
offset = exc.args[1]
if len(offset) > 2:
offset = offset[1:3]
- self.report_error(offset[0], offset[1],
+ self.report_error(offset[0], offset[1] or 0,
'E901 %s: %s' % (exc_type.__name__, exc.args[0]),
self.report_invalid_syntax)
report_invalid_syntax.__doc__ = " Check if the syntax is valid."