mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
Modified itertools.izip() to match the behavior of __builtin__.zip()
which can now take zero arguments.
This commit is contained in:
parent
77fe69bd08
commit
b5a420883c
4 changed files with 15 additions and 8 deletions
|
@ -1510,12 +1510,6 @@ izip_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
|||
PyObject *result;
|
||||
int tuplesize = PySequence_Length(args);
|
||||
|
||||
if (tuplesize < 1) {
|
||||
PyErr_SetString(PyExc_TypeError,
|
||||
"izip() requires at least one sequence");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* args must be a tuple */
|
||||
assert(PyTuple_Check(args));
|
||||
|
||||
|
@ -1598,6 +1592,8 @@ izip_next(izipobject *lz)
|
|||
PyObject *it;
|
||||
PyObject *item;
|
||||
|
||||
if (tuplesize == 0)
|
||||
return NULL;
|
||||
if (result->ob_refcnt == 1) {
|
||||
for (i=0 ; i < tuplesize ; i++) {
|
||||
it = PyTuple_GET_ITEM(lz->ittuple, i);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue