##// END OF EJS Templates
Fix Python2.4-only bug with automatic skipping of SystemExit
fperez -
Show More
@@ -6,7 +6,7 b' Requires Python 2.3 or newer.'
6
6
7 This file contains all the classes and helper functions specific to IPython.
7 This file contains all the classes and helper functions specific to IPython.
8
8
9 $Id: iplib.py 2614 2007-08-13 18:32:38Z vivainio $
9 $Id: iplib.py 2631 2007-08-15 07:07:36Z fperez $
10 """
10 """
11
11
12 #*****************************************************************************
12 #*****************************************************************************
@@ -2486,12 +2486,21 b' want to merge them back into the new files.""" % locals()'
2486 self.showsyntaxerror()
2486 self.showsyntaxerror()
2487 warn('Failure executing file: <%s>' % fname)
2487 warn('Failure executing file: <%s>' % fname)
2488 except SystemExit,status:
2488 except SystemExit,status:
2489 #print 'STATUS:',status # dbg
2489 # Code that correctly sets the exit status flag to success (0)
2490 # shouldn't be bothered with a traceback. Note that a plain
2491 # sys.exit() does NOT set the message to 0 (it's empty) so that
2492 # will still get a traceback. Note that the structure of the
2493 # SystemExit exception changed between Python 2.4 and 2.5, so
2494 # the checks must be done in a version-dependent way.
2495 show = False
2496
2497 if sys.version_info[:2] > (2,5):
2490 if status.message!=0 and not kw['exit_ignore']:
2498 if status.message!=0 and not kw['exit_ignore']:
2491 # Code that correctly sets the exit status flag to success
2499 show = True
2492 # (0) shouldn't be bothered with a traceback. Note that a
2500 else:
2493 # plain sys.exit() does NOT set the message to 0 (it's
2501 if status.code and not kw['exit_ignore']:
2494 # empty) so that will still get a traceback.
2502 show = True
2503 if show:
2495 self.showtraceback()
2504 self.showtraceback()
2496 warn('Failure executing file: <%s>' % fname)
2505 warn('Failure executing file: <%s>' % fname)
2497 except:
2506 except:
@@ -1,3 +1,10 b''
1 2007-08-15 Fernando Perez <Fernando.Perez@colorado.edu>
2
3 * IPython/iplib.py (safe_execfile): fix the SystemExit
4 auto-suppression code to work in Python2.4 (the internal structure
5 of that exception changed and I'd only tested the code with 2.5).
6 Bug reported by a SciPy attendee.
7
1 2007-08-13 Ville Vainio <vivainio@gmail.com>
8 2007-08-13 Ville Vainio <vivainio@gmail.com>
2
9
3 * prefilter.py: reverted !c:/bin/foo fix, made % in
10 * prefilter.py: reverted !c:/bin/foo fix, made % in
General Comments 0
You need to be logged in to leave comments. Login now