Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(64459)

Unified Diff: Python/ceval.c

Issue 25612: nested try..excepts don't work correctly for generators
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Lib/test/test_generators.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
--- a/Python/ceval.c Sun Nov 08 11:09:13 2015 +0000
+++ b/Python/ceval.c Thu Nov 12 19:15:12 2015 -0500
@@ -1192,7 +1192,10 @@
f->f_executing = 1;
if (co->co_flags & (CO_GENERATOR | CO_COROUTINE)) {
- if (!throwflag && f->f_exc_type != NULL && f->f_exc_type != Py_None) {
+ if ((!throwflag || tstate->exc_type == NULL ||
+ tstate->exc_type == Py_None)
+ && (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
(see YIELD_VALUE). */
« no previous file with comments | « Lib/test/test_generators.py ('k') | no next file » | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+