summaryrefslogtreecommitdiffstats
path: root/Python/pythonmain.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1991-12-31 13:14:48 (GMT)
committerGuido van Rossum <guido@python.org>1991-12-31 13:14:48 (GMT)
commita534ed3ee79726e2879c630eddd796249dcfb1df (patch)
treeb597ce78d4096859519e82fb32e64fffb402e043 /Python/pythonmain.c
parentafbb8db8e6647de7aaf20078c2259efbbfc086d0 (diff)
downloadcpython-a534ed3ee79726e2879c630eddd796249dcfb1df.zip
cpython-a534ed3ee79726e2879c630eddd796249dcfb1df.tar.gz
cpython-a534ed3ee79726e2879c630eddd796249dcfb1df.tar.bz2
Catch SystemExit and go away if it is caught.
Diffstat (limited to 'Python/pythonmain.c')
-rw-r--r--Python/pythonmain.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/Python/pythonmain.c b/Python/pythonmain.c
index 9fa1a58..0e47c9a 100644
--- a/Python/pythonmain.c
+++ b/Python/pythonmain.c
@@ -288,6 +288,17 @@ print_error()
{
object *exception, *v;
err_get(&exception, &v);
+ if (exception == SystemExit) {
+ if (v == NULL || v == None)
+ goaway(0);
+ if (is_intobject(v))
+ goaway((int)getintvalue(v));
+ else {
+ printobject(v, stderr, PRINT_RAW);
+ fprintf(stderr, "\n");
+ goaway(1);
+ }
+ }
fprintf(stderr, "Unhandled exception: ");
if (printobject(exception, stderr, PRINT_RAW) != 0)
err_clear();