]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Add sys.exitfunc feature. Make askync non-static.
authorGuido van Rossum <guido@python.org>
Thu, 3 Sep 1992 20:28:00 +0000 (20:28 +0000)
committerGuido van Rossum <guido@python.org>
Thu, 3 Sep 1992 20:28:00 +0000 (20:28 +0000)
Python/pythonrun.c

index 5358ee588b61a37236bbd4abe4f69b53f68e10fc..35b1815efceffbeb5285239c73a2b1283e51585b 100644 (file)
@@ -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;
 {