Commit 7ca531c4 authored by Stefan Behnel's avatar Stefan Behnel

speed up delegation of generators and coroutines a little by avoiding an...

speed up delegation of generators and coroutines a little by avoiding an indirect C call in favour of a directly visible recursive call
parent 553b552b
...@@ -713,7 +713,12 @@ static PyObject *__Pyx_Generator_Next(PyObject *self) { ...@@ -713,7 +713,12 @@ static PyObject *__Pyx_Generator_Next(PyObject *self) {
//Py_INCREF(yf); //Py_INCREF(yf);
// YieldFrom code ensures that yf is an iterator // YieldFrom code ensures that yf is an iterator
gen->is_running = 1; gen->is_running = 1;
ret = Py_TYPE(yf)->tp_iternext(yf); #ifdef __Pyx_Generator_USED
if (__Pyx_Generator_CheckExact(yf)) {
ret = __Pyx_Generator_Next(yf);
} else
#endif
ret = Py_TYPE(yf)->tp_iternext(yf);
gen->is_running = 0; gen->is_running = 0;
//Py_DECREF(yf); //Py_DECREF(yf);
if (likely(ret)) { if (likely(ret)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment