Show More
@@ -2130,7 +2130,20 b' class InteractiveShell(Configurable, Magic):' | |||||
2130 |
|
2130 | |||
2131 | with self.builtin_trap: |
|
2131 | with self.builtin_trap: | |
2132 | if len(cell.splitlines()) == 1: |
|
2132 | if len(cell.splitlines()) == 1: | |
2133 | cell = self.prefilter_manager.prefilter_lines(cell) |
|
2133 | try: | |
|
2134 | cell = self.prefilter_manager.prefilter_lines(cell) | |||
|
2135 | except Exception: | |||
|
2136 | # don't allow prefilter errors to crash IPython, because | |||
|
2137 | # user code can be involved (e.g. aliases) | |||
|
2138 | self.showtraceback() | |||
|
2139 | if store_history: | |||
|
2140 | self.history_manager.store_inputs(self.execution_count, | |||
|
2141 | cell, raw_cell) | |||
|
2142 | ||||
|
2143 | self.logger.log(cell, raw_cell) | |||
|
2144 | self.execution_count += 1 | |||
|
2145 | ||||
|
2146 | return | |||
2134 |
|
2147 | |||
2135 | # Store raw and processed history |
|
2148 | # Store raw and processed history | |
2136 | if store_history: |
|
2149 | if store_history: |
@@ -91,3 +91,9 b' class InteractiveShellTestCase(unittest.TestCase):' | |||||
91 | ip = get_ipython() |
|
91 | ip = get_ipython() | |
92 | ip.run_cell('a = """\n%exit\n"""') |
|
92 | ip.run_cell('a = """\n%exit\n"""') | |
93 | self.assertEquals(ip.user_ns['a'], '\n%exit\n') |
|
93 | self.assertEquals(ip.user_ns['a'], '\n%exit\n') | |
|
94 | ||||
|
95 | def test_alias_crash(self): | |||
|
96 | """Errors in prefilter can't crash IPython""" | |||
|
97 | ip = get_ipython() | |||
|
98 | ip.run_cell('%alias parts echo first %s second %s') | |||
|
99 | ip.run_cell('parts 1') |
General Comments 0
You need to be logged in to leave comments.
Login now