From: Guido van Rossum Date: Sat, 7 Oct 1995 19:14:01 +0000 (+0000) Subject: keep exitfunc alive while calling it X-Git-Tag: v1.3~66 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1c45ca310bad0bf387b08765a052be6ebf26d667;p=thirdparty%2FPython%2Fcpython.git keep exitfunc alive while calling it --- diff --git a/Python/pythonrun.c b/Python/pythonrun.c index 0666c5ac3729..9e402a62287e 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();