--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cgen/templates/default/yield_from Fri May 11 16:21:51 2012 -0700 @@ -0,0 +1,34 @@ + + TARGET(YIELD_FROM) + u = POP(); + x = TOP(); + /* send u to x */ + if (PyGen_CheckExact(x)) { + retval = _PyGen_Send((PyGenObject *)x, u); + } else { + _Py_IDENTIFIER(send); + if (u == Py_None) + retval = PyIter_Next(x); + else + retval = _PyObject_CallMethodId(x, &PyId_send, "O", u); + } + Py_DECREF(u); + if (!retval) { + PyObject *val; + x = POP(); /* Remove iter from stack */ + Py_DECREF(x); + err = PyGen_FetchStopIterationValue(&val); + if (err < 0) { + x = NULL; + goto on_error; + } + x = val; + PUSH(x); + goto fast_next_opcode; + } + /* x remains on stack, retval is value to be yielded */ + f->f_stacktop = stack_pointer; + why = WHY_YIELD; + /* and repeat... */ + f->f_lasti--; + goto fast_yield;