This commit is contained in:
Raymond Hettinger 2015-07-28 02:08:00 -07:00
commit 0ffc48ece9
1 changed files with 7 additions and 5 deletions

View File

@ -2787,11 +2787,13 @@ cwr_next(cwrobject *co)
if (result == NULL) if (result == NULL)
goto empty; goto empty;
co->result = result; co->result = result;
elem = PyTuple_GET_ITEM(pool, 0); if (n > 0) {
for (i=0; i<r ; i++) { elem = PyTuple_GET_ITEM(pool, 0);
assert(indices[i] == 0); for (i=0; i<r ; i++) {
Py_INCREF(elem); assert(indices[i] == 0);
PyTuple_SET_ITEM(result, i, elem); Py_INCREF(elem);
PyTuple_SET_ITEM(result, i, elem);
}
} }
} else { } else {
/* Copy the previous result tuple or re-use it if available */ /* Copy the previous result tuple or re-use it if available */