Show More
@@ -2092,19 +2092,20 b' class InteractiveShell(Configurable, Magic):' | |||
|
2092 | 2092 | # Store the untransformed code |
|
2093 | 2093 | raw_cell = cell |
|
2094 | 2094 | |
|
2095 | # We only do dynamic transforms on a single line. We need to do this | |
|
2096 | # first, because a macro can be expanded to several lines, which then | |
|
2097 | # need to be split into blocks again. | |
|
2098 | if len(cell.splitlines()) <= 1: | |
|
2099 | temp = self.input_splitter.split_blocks(cell) | |
|
2100 | cell = self.prefilter_manager.prefilter_line(temp[0]) | |
|
2101 | ||
|
2102 | 2095 | # We need to break up the input into executable blocks that can be run |
|
2103 | 2096 | # in 'single' mode, to provide comfortable user behavior. |
|
2104 | 2097 | blocks = self.input_splitter.split_blocks(cell) |
|
2105 | 2098 | |
|
2106 | if not blocks: | |
|
2099 | if not blocks: # Blank cell | |
|
2107 | 2100 | return |
|
2101 | ||
|
2102 | # We only do dynamic transforms on a single line. But a macro can | |
|
2103 | # be expanded to several lines, so we need to split it into input | |
|
2104 | # blocks again. | |
|
2105 | if len(cell.splitlines()) <= 1: | |
|
2106 | cell = self.prefilter_manager.prefilter_line(blocks[0]) | |
|
2107 | blocks = self.input_splitter.split_blocks(cell) | |
|
2108 | ||
|
2108 | 2109 | |
|
2109 | 2110 | # Store the 'ipython' version of the cell as well, since that's what |
|
2110 | 2111 | # needs to go into the translated history and get executed (the |
@@ -35,3 +35,9 b' class InteractiveShellTestCase(unittest.TestCase):' | |||
|
35 | 35 | # And also multi-line cells |
|
36 | 36 | ip.run_cell('"""a\nb"""\n') |
|
37 | 37 | self.assertEquals(ip.user_ns['_'], 'a\nb') |
|
38 | ||
|
39 | def test_run_empty_cell(self): | |
|
40 | """Just make sure we don't get a horrible error with a blank | |
|
41 | cell of input. Yes, I did overlook that.""" | |
|
42 | ip = get_ipython() | |
|
43 | ip.run_cell('') |
General Comments 0
You need to be logged in to leave comments.
Login now