Since the fast_yield branch target was introduced, it appears that most

tests of "why" against WHY_YIELD became useless.  This patch removes them,
but assert()s that why != WHY_YIELD everywhere such a test was removed.
The test suite ran fine under a debug build (i.e., the asserts never
triggered).
This commit is contained in:
Tim Peters 2004-04-05 19:36:21 +00:00
parent ed9192e2ae
commit 8a5c3c76be
1 changed files with 41 additions and 41 deletions

View File

@ -1653,8 +1653,8 @@ eval_frame(PyFrameObject *f)
v = POP(); v = POP();
if (PyInt_Check(v)) { if (PyInt_Check(v)) {
why = (enum why_code) PyInt_AS_LONG(v); why = (enum why_code) PyInt_AS_LONG(v);
assert(why != WHY_YIELD);
if (why == WHY_RETURN || if (why == WHY_RETURN ||
why == WHY_YIELD ||
why == WHY_CONTINUE) why == WHY_CONTINUE)
retval = POP(); retval = POP();
} }
@ -2325,9 +2325,10 @@ eval_frame(PyFrameObject *f)
/* Unwind stacks if a (pseudo) exception occurred */ /* Unwind stacks if a (pseudo) exception occurred */
fast_block_end: fast_block_end:
while (why != WHY_NOT && why != WHY_YIELD && f->f_iblock > 0) { while (why != WHY_NOT && f->f_iblock > 0) {
PyTryBlock *b = PyFrame_BlockPop(f); PyTryBlock *b = PyFrame_BlockPop(f);
assert(why != WHY_YIELD);
if (b->b_type == SETUP_LOOP && why == WHY_CONTINUE) { if (b->b_type == SETUP_LOOP && why == WHY_CONTINUE) {
/* For a continue inside a try block, /* For a continue inside a try block,
don't pop the block for the loop. */ don't pop the block for the loop. */
@ -2397,15 +2398,14 @@ fast_block_end:
} /* main loop */ } /* main loop */
if (why != WHY_YIELD) { assert(why != WHY_YIELD);
/* Pop remaining stack entries -- but when yielding */ /* Pop remaining stack entries. */
while (!EMPTY()) { while (!EMPTY()) {
v = POP(); v = POP();
Py_XDECREF(v); Py_XDECREF(v);
}
} }
if (why != WHY_RETURN && why != WHY_YIELD) if (why != WHY_RETURN)
retval = NULL; retval = NULL;
fast_yield: fast_yield: