diff Python/ceval.c @ 59440:edaafca87431

prevent generator finalization from invalidating sys.exc_info() #7173
author Benjamin Peterson <benjamin@python.org>
date Sun, 07 Mar 2010 17:10:51 +0000
parents 83c8dfb54421
children f49d24b4456e
line wrap: on
line diff
--- a/Python/ceval.c	Sun Mar 07 17:10:42 2010 +0000
+++ b/Python/ceval.c	Sun Mar 07 17:10:51 2010 +0000
@@ -1159,7 +1159,7 @@
 	assert(stack_pointer != NULL);
 	f->f_stacktop = NULL;	/* remains NULL unless yield suspends frame */
 
-	if (f->f_code->co_flags & CO_GENERATOR) {
+	if (co->co_flags & CO_GENERATOR && !throwflag) {
 		if (f->f_exc_type != NULL && f->f_exc_type != Py_None) {
 			/* We were in an except handler when we left,
 			   restore the exception state which was put aside