diff --git a/IPython/iplib.py b/IPython/iplib.py index 4b199c0..735bc0c 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 2614 2007-08-13 18:32:38Z vivainio $ +$Id: iplib.py 2631 2007-08-15 07:07:36Z fperez $ """ #***************************************************************************** @@ -2486,12 +2486,21 @@ want to merge them back into the new files.""" % locals() self.showsyntaxerror() warn('Failure executing file: <%s>' % fname) except SystemExit,status: - #print 'STATUS:',status # dbg - if status.message!=0 and not kw['exit_ignore']: - # Code that correctly sets the exit status flag to success - # (0) shouldn't be bothered with a traceback. Note that a - # plain sys.exit() does NOT set the message to 0 (it's - # empty) so that will still get a traceback. + # Code that correctly sets the exit status flag to success (0) + # shouldn't be bothered with a traceback. Note that a plain + # sys.exit() does NOT set the message to 0 (it's empty) so that + # will still get a traceback. Note that the structure of the + # SystemExit exception changed between Python 2.4 and 2.5, so + # the checks must be done in a version-dependent way. + show = False + + if sys.version_info[:2] > (2,5): + if status.message!=0 and not kw['exit_ignore']: + show = True + else: + if status.code and not kw['exit_ignore']: + show = True + if show: self.showtraceback() warn('Failure executing file: <%s>' % fname) except: diff --git a/doc/ChangeLog b/doc/ChangeLog index 6a56a30..8cf0c3e 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,10 @@ +2007-08-15 Fernando Perez + + * IPython/iplib.py (safe_execfile): fix the SystemExit + auto-suppression code to work in Python2.4 (the internal structure + of that exception changed and I'd only tested the code with 2.5). + Bug reported by a SciPy attendee. + 2007-08-13 Ville Vainio * prefilter.py: reverted !c:/bin/foo fix, made % in