diff Python/pythonrun.c @ 3152:a36e30240d06 legacy-trunk

keep exitfunc alive while calling it
author Guido van Rossum <guido@python.org>
date Sat, 07 Oct 1995 19:14:01 +0000
parents 692715abbd0b
children 3df9ab03badf
line wrap: on
line diff
--- a/Python/pythonrun.c	Sat Oct 07 19:08:37 1995 +0000
+++ b/Python/pythonrun.c	Sat Oct 07 19:14:01 1995 +0000
@@ -605,12 +605,14 @@
 
 	if (exitfunc) {
 		object *res;
+		INCREF(exitfunc);
 		sysset("exitfunc", (object *)NULL);
 		res = call_object(exitfunc, (object *)NULL);
 		if (res == NULL) {
 			fprintf(stderr, "Error in sys.exitfunc:\n");
 			print_error();
 		}
+		DECREF(exitfunc);
 	}
 
 	flushline();