summaryrefslogtreecommitdiff
path: root/pep8.py
diff options
context:
space:
mode:
authorFlorent Xicluna <florent.xicluna@gmail.com>2014-05-07 22:12:42 +0200
committerFlorent Xicluna <florent.xicluna@gmail.com>2014-05-07 22:12:42 +0200
commit588f1f49eb0567006564451923c439f77d33ff7e (patch)
tree3ad944e1a49a9cd984d9956a3271d560670390a8 /pep8.py
parent3beebfb0be9df325629ed249bd5a9576ffe79b2e (diff)
downloadpep8-588f1f49eb0567006564451923c439f77d33ff7e.tar.gz
Check the last line even if it does not end with a NL; issue #286
Diffstat (limited to 'pep8.py')
-rwxr-xr-xpep8.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/pep8.py b/pep8.py
index bc91137..0d7e294 100755
--- a/pep8.py
+++ b/pep8.py
@@ -1367,6 +1367,8 @@ class Checker(object):
tokengen = tokenize.generate_tokens(self.readline)
try:
for token in tokengen:
+ if token[2][0] > self.total_lines:
+ return
self.maybe_check_physical(token)
yield token
except (SyntaxError, tokenize.TokenError):
@@ -1449,10 +1451,8 @@ class Checker(object):
token[3] = (token[2][0], token[2][1] + len(token[1]))
self.tokens = [tuple(token)]
self.check_logical()
- if len(self.tokens) > 1 and (token_type == tokenize.ENDMARKER and
- self.tokens[-2][0] not in SKIP_TOKENS):
- self.tokens.pop()
- self.check_physical(self.tokens[-1][4])
+ if self.tokens:
+ self.check_physical(self.lines[-1])
self.check_logical()
return self.report.get_file_results()