mirror of https://github.com/python/cpython
merge
This commit is contained in:
commit
0ffc48ece9
|
@ -2787,12 +2787,14 @@ cwr_next(cwrobject *co)
|
||||||
if (result == NULL)
|
if (result == NULL)
|
||||||
goto empty;
|
goto empty;
|
||||||
co->result = result;
|
co->result = result;
|
||||||
|
if (n > 0) {
|
||||||
elem = PyTuple_GET_ITEM(pool, 0);
|
elem = PyTuple_GET_ITEM(pool, 0);
|
||||||
for (i=0; i<r ; i++) {
|
for (i=0; i<r ; i++) {
|
||||||
assert(indices[i] == 0);
|
assert(indices[i] == 0);
|
||||||
Py_INCREF(elem);
|
Py_INCREF(elem);
|
||||||
PyTuple_SET_ITEM(result, i, 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 */
|
||||||
if (Py_REFCNT(result) > 1) {
|
if (Py_REFCNT(result) > 1) {
|
||||||
|
|
Loading…
Reference in New Issue