]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
keep exitfunc alive while calling it
authorGuido van Rossum <guido@python.org>
Sat, 7 Oct 1995 19:14:01 +0000 (19:14 +0000)
committerGuido van Rossum <guido@python.org>
Sat, 7 Oct 1995 19:14:01 +0000 (19:14 +0000)
Python/pythonrun.c

index 0666c5ac3729734d675de684e7357e09ff106e11..9e402a62287ee43b6972b714cf31fe5a4a0c15ea 100644 (file)
@@ -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();