summaryrefslogtreecommitdiff
path: root/Python/pythonrun.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/pythonrun.c')
-rw-r--r--Python/pythonrun.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/Python/pythonrun.c b/Python/pythonrun.c
index 08d1dbe986..5358ee588b 100644
--- a/Python/pythonrun.c
+++ b/Python/pythonrun.c
@@ -361,6 +361,10 @@ fatal(msg)
/* Clean up and exit */
+#ifdef USE_THREAD
+extern int threads_started;
+#endif
+
void
goaway(sts)
int sts;
@@ -375,7 +379,10 @@ goaway(sts)
(void) save_thread();
donecalls();
- exit_prog(sts);
+ if (threads_started)
+ _exit_prog(sts);
+ else
+ exit_prog(sts);
#else /* USE_THREAD */