Show More
@@ -2172,7 +2172,9 b' class InteractiveShell(SingletonConfigurable, Magic):' | |||
|
2172 | 2172 | prefilter_failed = False |
|
2173 | 2173 | if len(cell.splitlines()) == 1: |
|
2174 | 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 | 2178 | except AliasError as e: |
|
2177 | 2179 | error(e) |
|
2178 | 2180 | prefilter_failed=True |
@@ -106,4 +106,11 b' class InteractiveShellTestCase(unittest.TestCase):' | |||
|
106 | 106 | err = io.stderr.getvalue() |
|
107 | 107 | io.stderr = save_err |
|
108 | 108 | self.assertEquals(err.split(':')[0], 'ERROR') |
|
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 | ||
|
109 | 116 |
General Comments 0
You need to be logged in to leave comments.
Login now