mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
Catch SystemExit and go away if it is caught.
This commit is contained in:
parent
afbb8db8e6
commit
a534ed3ee7
1 changed files with 11 additions and 0 deletions
|
@ -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();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue