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

Side by Side Diff: Python/ceval.c

Issue 25612: nested try..excepts don't work correctly for generators
Patch Set: Created 3 years, 4 months ago
Left:
Right:
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 unified diff | Download patch
« no previous file with comments | « Lib/test/test_generators.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* Execute compiled code */ 2 /* Execute compiled code */
3 3
4 /* XXX TO DO: 4 /* XXX TO DO:
5 XXX speed up searching for keywords by using a dictionary 5 XXX speed up searching for keywords by using a dictionary
6 XXX document it! 6 XXX document it!
7 */ 7 */
8 8
9 /* enable more aggressive intra-module optimizations, where available */ 9 /* enable more aggressive intra-module optimizations, where available */
10 #define PY_LOCAL_AGGRESSIVE 10 #define PY_LOCAL_AGGRESSIVE
(...skipping 1174 matching lines...) Expand 10 before | Expand all | Expand 10 after
1185 FOR_ITER is effectively a single opcode and f->f_lasti will point 1185 FOR_ITER is effectively a single opcode and f->f_lasti will point
1186 at to the beginning of the combined pair.) 1186 at to the beginning of the combined pair.)
1187 */ 1187 */
1188 next_instr = first_instr + f->f_lasti + 1; 1188 next_instr = first_instr + f->f_lasti + 1;
1189 stack_pointer = f->f_stacktop; 1189 stack_pointer = f->f_stacktop;
1190 assert(stack_pointer != NULL); 1190 assert(stack_pointer != NULL);
1191 f->f_stacktop = NULL; /* remains NULL unless yield suspends frame */ 1191 f->f_stacktop = NULL; /* remains NULL unless yield suspends frame */
1192 f->f_executing = 1; 1192 f->f_executing = 1;
1193 1193
1194 if (co->co_flags & (CO_GENERATOR | CO_COROUTINE)) { 1194 if (co->co_flags & (CO_GENERATOR | CO_COROUTINE)) {
1195 if (!throwflag && f->f_exc_type != NULL && f->f_exc_type != Py_None) { 1195 if ((!throwflag || tstate->exc_type == NULL ||
1196 tstate->exc_type == Py_None)
1197 && (f->f_exc_type != NULL && f->f_exc_type != Py_None))
1198 {
1196 /* We were in an except handler when we left, 1199 /* We were in an except handler when we left,
1197 restore the exception state which was put aside 1200 restore the exception state which was put aside
1198 (see YIELD_VALUE). */ 1201 (see YIELD_VALUE). */
1199 swap_exc_state(tstate, f); 1202 swap_exc_state(tstate, f);
1200 } 1203 }
1201 else 1204 else
1202 save_exc_state(tstate, f); 1205 save_exc_state(tstate, f);
1203 } 1206 }
1204 1207
1205 #ifdef LLTRACE 1208 #ifdef LLTRACE
(...skipping 4088 matching lines...) Expand 10 before | Expand all | Expand 10 after
5294 Py_DECREF(l); 5297 Py_DECREF(l);
5295 return NULL; 5298 return NULL;
5296 } 5299 }
5297 PyList_SetItem(l, i, x); 5300 PyList_SetItem(l, i, x);
5298 } 5301 }
5299 return l; 5302 return l;
5300 #endif 5303 #endif
5301 } 5304 }
5302 5305
5303 #endif 5306 #endif
OLDNEW
« 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+