[Python-checkins] cpython (2.7): Keep IDLE from displaying spurious SystemExit tracebacks

raymond.hettinger python-checkins at python.org
Sat Feb 9 20:21:16 CET 2013


http://hg.python.org/cpython/rev/872a3aca2120
changeset:   82103:872a3aca2120
branch:      2.7
parent:      82096:30f92600df9d
user:        Raymond Hettinger <python at rcn.com>
date:        Sat Feb 09 14:20:55 2013 -0500
summary:
  Keep IDLE from displaying spurious SystemExit tracebacks
when running scripts that terminated by raising SystemExit
(i.e. unittest and turtledemo).

files:
  Lib/idlelib/run.py |  5 ++++-
  Misc/NEWS          |  3 +++
  2 files changed, 7 insertions(+), 1 deletions(-)


diff --git a/Lib/idlelib/run.py b/Lib/idlelib/run.py
--- a/Lib/idlelib/run.py
+++ b/Lib/idlelib/run.py
@@ -301,11 +301,14 @@
                 exec code in self.locals
             finally:
                 interruptable = False
+        except SystemExit:
+            # Scripts that raise SystemExit should just
+            # return to the interactive prompt
+            pass
         except:
             self.usr_exc_info = sys.exc_info()
             if quitting:
                 exit()
-            # even print a user code SystemExit exception, continue
             print_exception()
             jit = self.rpchandler.console.getvar("<<toggle-jit-stack-viewer>>")
             if jit:
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -205,6 +205,9 @@
 - Issue #7358: cStringIO.StringIO now supports writing to and reading from
   a stream larger than 2 GiB on 64-bit systems.
 
+- IDLE was displaying spurious SystemExit tracebacks when running scripts
+  that terminated by raising SystemExit (i.e. unittest and turtledemo).
+
 - Issue #10355: In SpooledTemporaryFile class mode and name properties and
   xreadlines method now work for unrolled files.  encoding and newlines
   properties now removed as they have no sense and always produced

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list