Show More
@@ -2122,7 +2122,7 b' class InteractiveShell(Configurable, Magic):' | |||||
2122 | # This seems like a reasonable usability design. |
|
2122 | # This seems like a reasonable usability design. | |
2123 | last = blocks[-1] |
|
2123 | last = blocks[-1] | |
2124 | if len(last.splitlines()) < 2: |
|
2124 | if len(last.splitlines()) < 2: | |
2125 | self.runcode(''.join(blocks[:-1])) |
|
2125 | self.runcode(''.join(blocks[:-1]), post_execute=False) | |
2126 | self.runlines(last) |
|
2126 | self.runlines(last) | |
2127 | else: |
|
2127 | else: | |
2128 | self.runcode(cell) |
|
2128 | self.runcode(cell) | |
@@ -2232,7 +2232,7 b' class InteractiveShell(Configurable, Magic):' | |||||
2232 | else: |
|
2232 | else: | |
2233 | return None |
|
2233 | return None | |
2234 |
|
2234 | |||
2235 | def runcode(self, code_obj): |
|
2235 | def runcode(self, code_obj, post_execute=True): | |
2236 | """Execute a code object. |
|
2236 | """Execute a code object. | |
2237 |
|
2237 | |||
2238 | When an exception occurs, self.showtraceback() is called to display a |
|
2238 | When an exception occurs, self.showtraceback() is called to display a | |
@@ -2284,15 +2284,17 b' class InteractiveShell(Configurable, Magic):' | |||||
2284 | # are reported only minimally and just on the terminal, because the |
|
2284 | # are reported only minimally and just on the terminal, because the | |
2285 | # main exception channel may be occupied with a user traceback. |
|
2285 | # main exception channel may be occupied with a user traceback. | |
2286 | # FIXME: we need to think this mechanism a little more carefully. |
|
2286 | # FIXME: we need to think this mechanism a little more carefully. | |
2287 |
f |
|
2287 | if post_execute: | |
2288 | try: |
|
2288 | for func in self._post_execute: | |
2289 |
|
|
2289 | try: | |
2290 | except: |
|
2290 | func() | |
2291 | head = '[ ERROR ] Evaluating post_execute function: %s' % func |
|
2291 | except: | |
2292 | print >> io.Term.cout, head |
|
2292 | head = '[ ERROR ] Evaluating post_execute function: %s' % \ | |
2293 | print >> io.Term.cout, self._simple_error() |
|
2293 | func | |
2294 |
print >> io.Term.cout, |
|
2294 | print >> io.Term.cout, head | |
2295 | self._post_execute.remove(func) |
|
2295 | print >> io.Term.cout, self._simple_error() | |
|
2296 | print >> io.Term.cout, 'Removing from post_execute' | |||
|
2297 | self._post_execute.remove(func) | |||
2296 |
|
2298 | |||
2297 | # Flush out code object which has been run (and source) |
|
2299 | # Flush out code object which has been run (and source) | |
2298 | self.code_to_run = None |
|
2300 | self.code_to_run = None |
General Comments 0
You need to be logged in to leave comments.
Login now