Merge branch 'BYK-fix-empty-line-bug'

This commit is contained in:
Anthony Scopatz 2015-08-05 18:05:46 -05:00
commit ab19fa6ec1
2 changed files with 8 additions and 1 deletions

View file

@ -79,6 +79,12 @@ def test_bad_indent():
'x = 1\n')
assert_raises(SyntaxError, check_parse, code)
def test_indent_with_empty_line():
code = ('if True:\n'
'\n'
' some_command for_sub_process_mode\n')
yield check_parse, code
if __name__ == '__main__':

View file

@ -178,7 +178,8 @@ class Execer(object):
last_error_line = last_error_col = -1
input = '\n'.join(lines)
continue
if last_error_line > 1 and lines[idx-1].rstrip()[-1] == ':':
if last_error_line > 1 and lines[idx-1].rstrip()[-1:] == ':':
# catch non-indented blocks and raise error.
prev_indent = len(lines[idx-1]) - len(lines[idx-1].lstrip())
curr_indent = len(lines[idx]) - len(lines[idx].lstrip())