Show More
@@ -2172,7 +2172,9 b' class InteractiveShell(SingletonConfigurable, Magic):' | |||||
2172 | prefilter_failed = False |
|
2172 | prefilter_failed = False | |
2173 | if len(cell.splitlines()) == 1: |
|
2173 | if len(cell.splitlines()) == 1: | |
2174 | try: |
|
2174 | try: | |
2175 | cell = self.prefilter_manager.prefilter_line(cell) |
|
2175 | # use prefilter_lines to handle trailing newlines | |
|
2176 | # restore trailing newline for ast.parse | |||
|
2177 | cell = self.prefilter_manager.prefilter_lines(cell) + '\n' | |||
2176 | except AliasError as e: |
|
2178 | except AliasError as e: | |
2177 | error(e) |
|
2179 | error(e) | |
2178 | prefilter_failed=True |
|
2180 | prefilter_failed=True |
@@ -107,3 +107,10 b' class InteractiveShellTestCase(unittest.TestCase):' | |||||
107 | io.stderr = save_err |
|
107 | io.stderr = save_err | |
108 | self.assertEquals(err.split(':')[0], 'ERROR') |
|
108 | self.assertEquals(err.split(':')[0], 'ERROR') | |
109 |
|
109 | |||
|
110 | def test_trailing_newline(self): | |||
|
111 | """test that running !(command) does not raise a SyntaxError""" | |||
|
112 | ip = get_ipython() | |||
|
113 | ip.run_cell('!(true)\n', False) | |||
|
114 | ip.run_cell('!(true)\n\n\n', False) | |||
|
115 | ||||
|
116 |
General Comments 0
You need to be logged in to leave comments.
Login now