Commit a534ed3e authored by Guido van Rossum's avatar Guido van Rossum

Catch SystemExit and go away if it is caught.

parent afbb8db8
...@@ -288,6 +288,17 @@ print_error() ...@@ -288,6 +288,17 @@ print_error()
{ {
object *exception, *v; object *exception, *v;
err_get(&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: "); fprintf(stderr, "Unhandled exception: ");
if (printobject(exception, stderr, PRINT_RAW) != 0) if (printobject(exception, stderr, PRINT_RAW) != 0)
err_clear(); err_clear();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment