summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1995-03-17 10:42:27 (GMT)
committerGuido van Rossum <guido@python.org>1995-03-17 10:42:27 (GMT)
commit385e7c69198510a1aa3a50c82f0d458eb34cc5e6 (patch)
tree5c1e57596ae0698da0c524154bc176e3a68ac63c
parentfbd30e915953c471c9f364249c3b10f26ee30a2b (diff)
downloadcpython-385e7c69198510a1aa3a50c82f0d458eb34cc5e6.zip
cpython-385e7c69198510a1aa3a50c82f0d458eb34cc5e6.tar.gz
cpython-385e7c69198510a1aa3a50c82f0d458eb34cc5e6.tar.bz2
implement exit_thread through SystemExit exception
-rw-r--r--Modules/threadmodule.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/Modules/threadmodule.c b/Modules/threadmodule.c
index 9cb4cba..befe6a2 100644
--- a/Modules/threadmodule.c
+++ b/Modules/threadmodule.c
@@ -200,8 +200,12 @@ t_bootstrap(args_raw)
res = call_object(func, arg);
DECREF(args); /* Matches the INCREF(args) in thread_start_new_thread */
if (res == NULL) {
- fprintf(stderr, "Unhandled exception in thread:\n");
- print_error(); /* From pythonmain.c */
+ if (err_occurred() == SystemExit)
+ err_clear();
+ else {
+ fprintf(stderr, "Unhandled exception in thread:\n");
+ print_error(); /* From pythonmain.c */
+ }
}
else
DECREF(res);
@@ -236,13 +240,10 @@ thread_exit_thread(self, args)
object *self; /* Not used */
object *args;
{
- object *frame;
if (!getnoarg(args))
return NULL;
- frame = save_thread(); /* Should never be NULL */
- DECREF(frame);
- exit_thread();
- for (;;) { } /* Should not be reached */
+ err_set(SystemExit);
+ return NULL;
}
#ifndef NO_EXIT_PROG