diff --git a/IPython/CrashHandler.py b/IPython/CrashHandler.py index c223b41..857abe5 100644 --- a/IPython/CrashHandler.py +++ b/IPython/CrashHandler.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- """sys.excepthook for IPython itself, leaves a detailed report on disk. -$Id: CrashHandler.py 1828 2006-10-16 02:04:33Z fptest $""" +$Id: CrashHandler.py 2908 2007-12-30 21:07:46Z vivainio $""" #***************************************************************************** # Copyright (C) 2001-2006 Fernando Perez. @@ -154,6 +154,7 @@ $self.bug_tracker # Construct report on disk report.write(self.make_report(traceback)) report.close() + raw_input("Press enter to exit:") def make_report(self,traceback): """Return a string containing a crash report.""" diff --git a/IPython/iplib.py b/IPython/iplib.py index 3a6bf08..3447e13 100644 --- a/IPython/iplib.py +++ b/IPython/iplib.py @@ -6,7 +6,7 @@ Requires Python 2.3 or newer. This file contains all the classes and helper functions specific to IPython. -$Id: iplib.py 2899 2007-12-28 08:32:59Z fperez $ +$Id: iplib.py 2908 2007-12-30 21:07:46Z vivainio $ """ #***************************************************************************** @@ -218,7 +218,6 @@ class InteractiveShell(object,Magic): for ns in (user_ns,user_global_ns): if ns is not None and type(ns) != types.DictType: raise TypeError,'namespace must be a dictionary' - # Job manager (for jobs run as background threads) self.jobs = BackgroundJobManager() @@ -1551,7 +1550,13 @@ want to merge them back into the new files.""" % locals() else: banner = self.BANNER+self.banner2 - self.interact(banner) + while 1: + try: + self.interact(banner) + except KeyboardInterrupt: + # this should not be necessary, but KeyboardInterrupt + # handling seems rather unpredictable... + self.write("\nKeyboardInterrupt in interact()\n") def exec_init_cmd(self): """Execute a command given at the command line. @@ -1682,14 +1687,18 @@ want to merge them back into the new files.""" % locals() self.rl_do_indent = False except KeyboardInterrupt: - self.write('\nKeyboardInterrupt\n') - self.resetbuffer() - # keep cache in sync with the prompt counter: - self.outputcache.prompt_count -= 1 - - if self.autoindent: - self.indent_current_nsp = 0 - more = 0 + #double-guard against keyboardinterrupts during kbdint handling + try: + self.write('\nKeyboardInterrupt\n') + self.resetbuffer() + # keep cache in sync with the prompt counter: + self.outputcache.prompt_count -= 1 + + if self.autoindent: + self.indent_current_nsp = 0 + more = 0 + except KeyboardInterrupt: + pass except EOFError: if self.autoindent: self.rl_do_indent = False diff --git a/IPython/ultraTB.py b/IPython/ultraTB.py index ae82a8f..bccdcac 100644 --- a/IPython/ultraTB.py +++ b/IPython/ultraTB.py @@ -60,7 +60,7 @@ You can implement other color schemes easily, the syntax is fairly self-explanatory. Please send back new schemes you develop to the author for possible inclusion in future releases. -$Id: ultraTB.py 2907 2007-12-30 20:33:06Z vivainio $""" +$Id: ultraTB.py 2908 2007-12-30 21:07:46Z vivainio $""" #***************************************************************************** # Copyright (C) 2001 Nathaniel Gray @@ -869,7 +869,7 @@ class VerboseTB(TBTools): try: self.debugger() except KeyboardInterrupt: - print "KeyboardInterrupt" + print "\nKeyboardInterrupt" #---------------------------------------------------------------------------- class FormattedTB(VerboseTB,ListTB): @@ -987,7 +987,7 @@ class AutoFormattedTB(FormattedTB): try: self.debugger() except KeyboardInterrupt: - print "KeyboardInterrupt" + print "\nKeyboardInterrupt" def text(self,etype=None,value=None,tb=None,context=5,mode=None): if etype is None: