diff options
-rwxr-xr-x | pep8.py | 12 | ||||
-rw-r--r-- | testsuite/W39no.py | 6 |
2 files changed, 12 insertions, 6 deletions
@@ -1249,7 +1249,7 @@ class Checker(object): arguments.append(getattr(self, name)) return check(*arguments) - def check_physical(self, line_number, line): + def check_physical(self, line): """ Run all physical checks on a raw input line. """ @@ -1258,7 +1258,7 @@ class Checker(object): result = self.run_check(check, argument_names) if result is not None: offset, text = result - self.report_error(line_number, offset, text, check) + self.report_error(self.line_number, offset, text, check) def build_tokens_line(self): """ @@ -1358,12 +1358,12 @@ class Checker(object): # *not* check the last line: its newline is outside of the # multiline string, so we consider it a regular physical line # (it will be checked when we see the newline token). - line_number = token[2][0] + self.line_number = token[2][0] for line in token[1].split('\n')[:-1]: - self.check_physical(line_number, line + '\n') - line_number += 1 + self.check_physical(line + '\n') + self.line_number += 1 elif token[0] in (tokenize.NEWLINE, tokenize.NL): - self.check_physical(self.line_number, token[4]) + self.check_physical(token[4]) def check_all(self, expected=None, line_offset=0): """ diff --git a/testsuite/W39no.py b/testsuite/W39no.py new file mode 100644 index 0000000..2948b82 --- /dev/null +++ b/testsuite/W39no.py @@ -0,0 +1,6 @@ +#: Okay +'''there is nothing wrong +with a multiline string at EOF + +that happens to have a blank line in it +''' |