diff Python/pythonrun.c @ 1015:f3d5e2c3b9a3 legacy-trunk

Add sys.exitfunc feature. Make askync non-static.
author Guido van Rossum <guido@python.org>
date Thu, 03 Sep 1992 20:28:00 +0000
parents a31e07847063
children 2c0432fcc270
line wrap: on
line diff
--- a/Python/pythonrun.c	Thu Sep 03 20:26:57 1992 +0000
+++ b/Python/pythonrun.c	Thu Sep 03 20:28:00 1992 +0000
@@ -369,6 +369,25 @@
 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 @@
 #ifdef TRACE_REFS
 /* Ask a yes/no question */
 
-static int
+int
 askyesno(prompt)
 	char *prompt;
 {