Don't store the exception info from an unhandled exception in a thread
in sys.last_*; it prevents proper calling of destructors of local
variables.
diff --git a/Modules/threadmodule.c b/Modules/threadmodule.c
index 214263f..51c24d1 100644
--- a/Modules/threadmodule.c
+++ b/Modules/threadmodule.c
@@ -219,7 +219,7 @@
 			PyErr_Clear();
 		else {
 			fprintf(stderr, "Unhandled exception in thread:\n");
-			PyErr_Print();
+			PyErr_PrintEx(0);
 		}
 	}
 	else