From 1c45ca310bad0bf387b08765a052be6ebf26d667 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Sat, 7 Oct 1995 19:14:01 +0000 Subject: keep exitfunc alive while calling it --- Python/pythonrun.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'Python/pythonrun.c') diff --git a/Python/pythonrun.c b/Python/pythonrun.c index 0666c5ac37..9e402a6228 100644 --- a/Python/pythonrun.c +++ b/Python/pythonrun.c @@ -605,12 +605,14 @@ cleanup() 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(); -- cgit v1.2.1