Keep IDLE from displaying spurious SystemExit tracebacks
authorRaymond Hettinger <python@rcn.com>
Sat, 9 Feb 2013 19:20:55 +0000 (14:20 -0500)
committerRaymond Hettinger <python@rcn.com>
Sat, 9 Feb 2013 19:20:55 +0000 (14:20 -0500)
when running scripts that terminated by raising SystemExit
(i.e. unittest and turtledemo).

Lib/idlelib/run.py
Misc/NEWS

index acae3aea7ad1781e707ed4e5bf073584bb8f73a8..e82ebf4c92ae83050f6ef4b404542f9f8e9eb49a 100644 (file)
@@ -301,11 +301,14 @@ class Executive(object):
                 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:
index 92bd686ae824b243731760cd53922248ab979040..71db196a5e9cbcea97662b4cb2e12801881e9d8d 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -205,6 +205,9 @@ Library
 - 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