##// END OF EJS Templates
Don't unregister failing post-exec callbacks automatically...
MinRK -
Show More
@@ -261,6 +261,9 b' class InteractiveShell(SingletonConfigurable, Magic):'
261 261 deep_reload will still be available as dreload().
262 262 """
263 263 )
264 disable_failing_post_execute = CBool(False, config=True,
265 help="Don't call post-execute functions that have failed in the past."""
266 )
264 267 display_formatter = Instance(DisplayFormatter)
265 268 displayhook_class = Type(DisplayHook)
266 269 display_pub_class = Type(DisplayPublisher)
@@ -749,7 +752,7 b' class InteractiveShell(SingletonConfigurable, Magic):'
749 752 if not callable(func):
750 753 raise ValueError('argument %s must be callable' % func)
751 754 self._post_execute[func] = True
752
755
753 756 #-------------------------------------------------------------------------
754 757 # Things related to the "main" module
755 758 #-------------------------------------------------------------------------
@@ -2426,17 +2429,22 b' class InteractiveShell(SingletonConfigurable, Magic):'
2426 2429
2427 2430 # Execute any registered post-execution functions.
2428 2431 for func, status in self._post_execute.iteritems():
2429 if not status:
2432 if self.disable_failing_post_execute and not status:
2430 2433 continue
2431 2434 try:
2432 2435 func()
2433 2436 except KeyboardInterrupt:
2434 2437 print >> io.stderr, "\nKeyboardInterrupt"
2435 2438 except Exception:
2436 print >> io.stderr, "Disabling failed post-execution function: %s" % func
2437 self.showtraceback()
2438 # Deactivate failing function
2439 # register as failing:
2439 2440 self._post_execute[func] = False
2441 self.showtraceback()
2442 print >> io.stderr, '\n'.join([
2443 "post-execution function %r produced an error." % func,
2444 "If this problem persists, you can disable failing post-exec functions with:",
2445 "",
2446 " get_ipython().disable_failing_post_execute = True"
2447 ])
2440 2448
2441 2449 if store_history:
2442 2450 # Write output to the database. Does nothing unless
General Comments 0
You need to be logged in to leave comments. Login now