summaryrefslogtreecommitdiffstats
path: root/Lib/idlelib/run.py
diff options
context:
space:
mode:
authorTerry Jan Reedy <tjreedy@udel.edu>2019-05-20 02:52:22 (GMT)
committerGitHub <noreply@github.com>2019-05-20 02:52:22 (GMT)
commit6d965b39b7a486dd9e96a60b19ee92382d668299 (patch)
tree8f314cbd9cda4bfc8aa7e2544a18f2bec6035fb2 /Lib/idlelib/run.py
parent53d378c81286644138415cb56da52a7351e1a477 (diff)
downloadcpython-6d965b39b7a486dd9e96a60b19ee92382d668299.zip
cpython-6d965b39b7a486dd9e96a60b19ee92382d668299.tar.gz
cpython-6d965b39b7a486dd9e96a60b19ee92382d668299.tar.bz2
bpo-36958: In IDLE, print exit message (GH-13435)
Print any argument other than None or int passed to SystemExit or sys.exit().
Diffstat (limited to 'Lib/idlelib/run.py')
-rw-r--r--Lib/idlelib/run.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/Lib/idlelib/run.py b/Lib/idlelib/run.py
index 6fa373f..b4a2b54 100644
--- a/Lib/idlelib/run.py
+++ b/Lib/idlelib/run.py
@@ -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: