summaryrefslogtreecommitdiffstats
path: root/Modules/itertoolsmodule.c
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2003-08-08 05:10:41 (GMT)
committerRaymond Hettinger <python@rcn.com>2003-08-08 05:10:41 (GMT)
commitb5a420883c2ed3a4fc74b212ab0454991fe90bcc (patch)
treea7238608d1225716fec2e766353651f22c467857 /Modules/itertoolsmodule.c
parent77fe69bd082496151debfbd369864e71bbd58de2 (diff)
downloadcpython-b5a420883c2ed3a4fc74b212ab0454991fe90bcc.zip
cpython-b5a420883c2ed3a4fc74b212ab0454991fe90bcc.tar.gz
cpython-b5a420883c2ed3a4fc74b212ab0454991fe90bcc.tar.bz2
Modified itertools.izip() to match the behavior of __builtin__.zip()
which can now take zero arguments.
Diffstat (limited to 'Modules/itertoolsmodule.c')
-rw-r--r--Modules/itertoolsmodule.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/Modules/itertoolsmodule.c b/Modules/itertoolsmodule.c
index e63d02a..4a99fce 100644
--- a/Modules/itertoolsmodule.c
+++ b/Modules/itertoolsmodule.c
@@ -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);