diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2015-01-31 10:08:40 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2015-01-31 10:08:40 (GMT) |
commit | 13a1c6022b72cab0ff45a4e7b71305ed25ad9490 (patch) | |
tree | 158ef1b9eeefc9010a260eb7ce3270a0ef471966 /Python/ceval.c | |
parent | 57f7db312210fcdc5db00f8e6a67f682ced342e3 (diff) | |
parent | 26f7b8acdc010801a8fe877376488e0b69a89dad (diff) | |
download | cpython-13a1c6022b72cab0ff45a4e7b71305ed25ad9490.zip cpython-13a1c6022b72cab0ff45a4e7b71305ed25ad9490.tar.gz cpython-13a1c6022b72cab0ff45a4e7b71305ed25ad9490.tar.bz2 |
Merge 3.4 (generator)
Diffstat (limited to 'Python/ceval.c')
-rw-r--r-- | Python/ceval.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Python/ceval.c b/Python/ceval.c index e92a339..e09ff34 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -1189,8 +1189,8 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag) f->f_stacktop = NULL; /* remains NULL unless yield suspends frame */ f->f_executing = 1; - if (co->co_flags & CO_GENERATOR && !throwflag) { - if (f->f_exc_type != NULL && f->f_exc_type != Py_None) { + if (co->co_flags & CO_GENERATOR) { + if (!throwflag && 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). */ @@ -3196,7 +3196,8 @@ fast_block_end: || (retval == NULL && PyErr_Occurred())); fast_yield: - if (co->co_flags & CO_GENERATOR && (why == WHY_YIELD || why == WHY_RETURN)) { + if (co->co_flags & CO_GENERATOR) { + /* The purpose of this block is to put aside the generator's exception state and restore that of the calling frame. If the current exception state is from the caller, we clear the exception values |