comparison 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
comparison
equal deleted inserted replaced
3151:acff79dd14b7 3152:a36e30240d06
603 { 603 {
604 object *exitfunc = sysget("exitfunc"); 604 object *exitfunc = sysget("exitfunc");
605 605
606 if (exitfunc) { 606 if (exitfunc) {
607 object *res; 607 object *res;
608 INCREF(exitfunc);
608 sysset("exitfunc", (object *)NULL); 609 sysset("exitfunc", (object *)NULL);
609 res = call_object(exitfunc, (object *)NULL); 610 res = call_object(exitfunc, (object *)NULL);
610 if (res == NULL) { 611 if (res == NULL) {
611 fprintf(stderr, "Error in sys.exitfunc:\n"); 612 fprintf(stderr, "Error in sys.exitfunc:\n");
612 print_error(); 613 print_error();
613 } 614 }
615 DECREF(exitfunc);
614 } 616 }
615 617
616 flushline(); 618 flushline();
617 619
618 while (nexitfuncs > 0) 620 while (nexitfuncs > 0)