Show More
@@ -1605,6 +1605,10 b' class InteractiveShell(SingletonConfigurable, Magic):' | |||
|
1605 | 1605 | value = msg, (filename, lineno, offset, line) |
|
1606 | 1606 | stb = self.SyntaxTB.structured_traceback(etype, value, []) |
|
1607 | 1607 | self._showtraceback(etype, value, stb) |
|
1608 | ||
|
1609 | # This is overridden in TerminalInteractiveShell to show a message about | |
|
1610 | # the %paste magic. | |
|
1611 | showindentationerror = showsyntaxerror | |
|
1608 | 1612 | |
|
1609 | 1613 | #------------------------------------------------------------------------- |
|
1610 | 1614 | # Things related to readline |
@@ -2274,8 +2278,7 b' class InteractiveShell(SingletonConfigurable, Magic):' | |||
|
2274 | 2278 | try: |
|
2275 | 2279 | code_ast = ast.parse(cell, filename=cell_name) |
|
2276 | 2280 | except IndentationError: |
|
2277 |
self.show |
|
|
2278 | print("If you want to paste code into IPython, try the %paste magic function.") | |
|
2281 | self.showindentationerror() | |
|
2279 | 2282 | self.execution_count += 1 |
|
2280 | 2283 | return None |
|
2281 | 2284 | except (OverflowError, SyntaxError, ValueError, TypeError, |
@@ -588,6 +588,10 b' class TerminalInteractiveShell(InteractiveShell):' | |||
|
588 | 588 | write("## -- End pasted text --\n") |
|
589 | 589 | |
|
590 | 590 | self._execute_block(block, par) |
|
591 | ||
|
592 | def showindentationerror(self): | |
|
593 | super(TerminalInteractiveShell, self).showindentationerror() | |
|
594 | print("If you want to paste code into IPython, try the %paste magic function.") | |
|
591 | 595 | |
|
592 | 596 | |
|
593 | 597 | InteractiveShellABC.register(TerminalInteractiveShell) |
General Comments 0
You need to be logged in to leave comments.
Login now