Index: pep8-1.7.1/pep8.py =================================================================== --- pep8-1.7.1/pep8.py +++ pep8-1.7.1/pep8.py 2019-01-07 11:29:52.016172213 +0100 @@ -190,10 +190,10 @@ """ if line_number == total_lines: stripped_last_line = physical_line.rstrip() - if not stripped_last_line: + if physical_line and not stripped_last_line: return 0, "W391 blank line at end of file" if stripped_last_line == physical_line: - return len(physical_line), "W292 no newline at end of file" + return len(lines[-1]), "W292 no newline at end of file" def maximum_line_length(physical_line, max_line_length, multiline):