Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 59bff39

Browse files
committed
Add sys.exitfunc feature. Make askync non-static.
1 parent da8cd86 commit 59bff39

1 file changed

Lines changed: 20 additions & 1 deletion

File tree

Python/pythonrun.c

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,25 @@ void
369369
goaway(sts)
370370
int sts;
371371
{
372+
object *exitfunc = sysget("exitfunc");
373+
374+
if (exitfunc) {
375+
object *arg;
376+
object *res;
377+
sysset("exitfunc", (object *)NULL);
378+
arg = newtupleobject(0);
379+
if (arg == NULL)
380+
res = NULL;
381+
else {
382+
res = call_object(exitfunc, arg);
383+
DECREF(arg);
384+
}
385+
if (res == NULL) {
386+
fprintf(stderr, "Error in sys.exitfunc:\n");
387+
print_error();
388+
}
389+
}
390+
372391
flushline();
373392

374393
#ifdef USE_THREAD
@@ -411,7 +430,7 @@ goaway(sts)
411430
#ifdef TRACE_REFS
412431
/* Ask a yes/no question */
413432

414-
static int
433+
int
415434
askyesno(prompt)
416435
char *prompt;
417436
{

0 commit comments

Comments
 (0)