diff Modules/threadmodule.c @ 2568:2c61786327cf legacy-trunk

implement exit_thread through SystemExit exception
author Guido van Rossum <guido@python.org>
date Fri, 17 Mar 1995 10:42:27 +0000
parents fd5ab7e828fc
children 65d2d8e67da3
line wrap: on
line diff
--- a/Modules/threadmodule.c	Thu Mar 16 16:07:34 1995 +0000
+++ b/Modules/threadmodule.c	Fri Mar 17 10:42:27 1995 +0000
@@ -200,8 +200,12 @@
 	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 @@
 	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