From ae5f2f4a39e6a3f4c45e9dc95bd4e1fe5dfb60f2 Mon Sep 17 00:00:00 2001 From: Benjamin Peterson Date: Sun, 7 Mar 2010 17:10:51 +0000 Subject: prevent generator finalization from invalidating sys.exc_info() #7173 --- Python/ceval.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Python') diff --git a/Python/ceval.c b/Python/ceval.c index 5d1fb285be..47c53cfa04 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -1159,7 +1159,7 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag) 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 -- cgit v1.2.1