str().split() | grep exit now throws a SyntaxError

This commit is contained in:
Anthony Scopatz 2016-05-19 20:12:07 -04:00
parent 4d86b7bdec
commit c1712eeaed
2 changed files with 16 additions and 1 deletions

View file

@ -83,6 +83,20 @@ def test_bad_indent():
'x = 1\n')
assert_raises(SyntaxError, check_parse, code)
def test_bad_rhs_subproc():
code = 'str().split() | grep exit\n'
assert_raises(SyntaxError, check_parse, code)
def test_good_rhs_subproc():
# nonsense but parsebale
code = 'str().split() | ![grep exit]\n'
check_parse(code)
def test_bad_rhs_subproc():
# nonsense but unparsebale
code = 'str().split() | grep exit\n'
assert_raises(SyntaxError, check_parse, code)
def test_indent_with_empty_line():
code = ('if True:\n'
'\n'

View file

@ -204,7 +204,8 @@ class Execer(object):
else:
# or for some other syntax error
raise original_error
elif sbpline.lstrip().startswith('![!['):
elif sbpline[last_error_col:].startswith('![![') or \
sbpline.lstrip().startswith('![!['):
# if we have already wrapped this in subproc tokens
# and it still doesn't work, adding more won't help
# anything