mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
bpo-36958: In IDLE, print exit message (GH-13435)
Print any argument other than None or int passed to SystemExit or sys.exit().
This commit is contained in:
parent
53d378c812
commit
6d965b39b7
5 changed files with 20 additions and 6 deletions
|
@ -474,15 +474,16 @@ class Executive(object):
|
|||
exec(code, self.locals)
|
||||
finally:
|
||||
interruptable = False
|
||||
except SystemExit:
|
||||
# Scripts that raise SystemExit should just
|
||||
# return to the interactive prompt
|
||||
pass
|
||||
except SystemExit as e:
|
||||
if e.args: # SystemExit called with an argument.
|
||||
ob = e.args[0]
|
||||
if not isinstance(ob, (type(None), int)):
|
||||
print('SystemExit: ' + str(ob), file=sys.stderr)
|
||||
# Return to the interactive prompt.
|
||||
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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue