From: Guido van Rossum Date: Tue, 31 Dec 1991 13:14:48 +0000 (+0000) Subject: Catch SystemExit and go away if it is caught. X-Git-Tag: v0.9.8~636 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a534ed3ee79726e2879c630eddd796249dcfb1df;p=thirdparty%2FPython%2Fcpython.git Catch SystemExit and go away if it is caught. --- diff --git a/Python/pythonmain.c b/Python/pythonmain.c index 9fa1a588dbe1..0e47c9a3d609 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();