mirror of
https://github.com/python/cpython.git
synced 2025-07-19 09:15:34 +00:00
As discussed on python-dev, changed builtin.zip() to handle zero arguments
by returning an empty list instead of raising a TypeError.
This commit is contained in:
parent
9463792c68
commit
eaef615116
5 changed files with 20 additions and 11 deletions
|
@ -1916,11 +1916,9 @@ builtin_zip(PyObject *self, PyObject *args)
|
|||
PyObject *itlist; /* tuple of iterators */
|
||||
int len; /* guess at result length */
|
||||
|
||||
if (itemsize < 1) {
|
||||
PyErr_SetString(PyExc_TypeError,
|
||||
"zip() requires at least one sequence");
|
||||
return NULL;
|
||||
}
|
||||
if (itemsize == 0)
|
||||
return PyList_New(0);
|
||||
|
||||
/* args must be a tuple */
|
||||
assert(PyTuple_Check(args));
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue