summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2003-08-02 07:42:57 (GMT)
committerRaymond Hettinger <python@rcn.com>2003-08-02 07:42:57 (GMT)
commiteaef61511656071194565878dc80c46096d46415 (patch)
treeb3e761f4c79ace0c0baeeb3ed845afd14ca666bb /Python
parent9463792c686c312dcf85c649b7183eae25403945 (diff)
downloadcpython-eaef61511656071194565878dc80c46096d46415.zip
cpython-eaef61511656071194565878dc80c46096d46415.tar.gz
cpython-eaef61511656071194565878dc80c46096d46415.tar.bz2
As discussed on python-dev, changed builtin.zip() to handle zero arguments
by returning an empty list instead of raising a TypeError.
Diffstat (limited to 'Python')
-rw-r--r--Python/bltinmodule.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c
index 49fcc09..fb92478 100644
--- a/Python/bltinmodule.c
+++ b/Python/bltinmodule.c
@@ -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));