From: Guido van Rossum Date: Thu, 3 Sep 1992 20:28:00 +0000 (+0000) Subject: Add sys.exitfunc feature. Make askync non-static. X-Git-Tag: v0.9.8~168 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=59bff399a08b29b93b9d87c422f7077fc75c2a2a;p=thirdparty%2FPython%2Fcpython.git Add sys.exitfunc feature. Make askync non-static. --- diff --git a/Python/pythonrun.c b/Python/pythonrun.c index 5358ee588b61..35b1815efcef 100644 --- a/Python/pythonrun.c +++ b/Python/pythonrun.c @@ -369,6 +369,25 @@ void goaway(sts) int sts; { + object *exitfunc = sysget("exitfunc"); + + if (exitfunc) { + object *arg; + object *res; + sysset("exitfunc", (object *)NULL); + arg = newtupleobject(0); + if (arg == NULL) + res = NULL; + else { + res = call_object(exitfunc, arg); + DECREF(arg); + } + if (res == NULL) { + fprintf(stderr, "Error in sys.exitfunc:\n"); + print_error(); + } + } + flushline(); #ifdef USE_THREAD @@ -411,7 +430,7 @@ goaway(sts) #ifdef TRACE_REFS /* Ask a yes/no question */ -static int +int askyesno(prompt) char *prompt; {