Keep IDLE from displaying spurious SystemExit tracebacks

when running scripts that terminated by raising SystemExit
(i.e. unittest and turtledemo).
This commit is contained in:
Raymond Hettinger 2013-02-09 14:20:55 -05:00
parent a5e7f8f8e0
commit 4234992c75
2 changed files with 7 additions and 1 deletions

View File

@ -301,11 +301,14 @@ class Executive(object):
exec code in self.locals exec code in self.locals
finally: finally:
interruptable = False interruptable = False
except SystemExit:
# Scripts that raise SystemExit should just
# return to the interactive prompt
pass
except: except:
self.usr_exc_info = sys.exc_info() self.usr_exc_info = sys.exc_info()
if quitting: if quitting:
exit() exit()
# even print a user code SystemExit exception, continue
print_exception() print_exception()
jit = self.rpchandler.console.getvar("<<toggle-jit-stack-viewer>>") jit = self.rpchandler.console.getvar("<<toggle-jit-stack-viewer>>")
if jit: if jit:

View File

@ -205,6 +205,9 @@ Library
- Issue #7358: cStringIO.StringIO now supports writing to and reading from - Issue #7358: cStringIO.StringIO now supports writing to and reading from
a stream larger than 2 GiB on 64-bit systems. 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 - Issue #10355: In SpooledTemporaryFile class mode and name properties and
xreadlines method now work for unrolled files. encoding and newlines xreadlines method now work for unrolled files. encoding and newlines
properties now removed as they have no sense and always produced properties now removed as they have no sense and always produced