diff options
author | Raymond Hettinger <python@rcn.com> | 2008-01-17 03:02:14 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2008-01-17 03:02:14 (GMT) |
commit | 473170908e11e347aca4adf23738a82162b981e3 (patch) | |
tree | 2fa25a5ccd4abfc71e6a0f5193838a726ce4c68a /Modules/itertoolsmodule.c | |
parent | 3ad2acc8575e1977cece844b17c572550503a615 (diff) | |
download | cpython-473170908e11e347aca4adf23738a82162b981e3.zip cpython-473170908e11e347aca4adf23738a82162b981e3.tar.gz cpython-473170908e11e347aca4adf23738a82162b981e3.tar.bz2 |
Make starmap() match its pure python definition and accept any itertable input (not just tuples).
Diffstat (limited to 'Modules/itertoolsmodule.c')
-rw-r--r-- | Modules/itertoolsmodule.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Modules/itertoolsmodule.c b/Modules/itertoolsmodule.c index ebb4deb..430313e 100644 --- a/Modules/itertoolsmodule.c +++ b/Modules/itertoolsmodule.c @@ -1356,10 +1356,11 @@ starmap_next(starmapobject *lz) if (args == NULL) return NULL; if (!PyTuple_CheckExact(args)) { + PyObject *newargs = PySequence_Tuple(args); Py_DECREF(args); - PyErr_SetString(PyExc_TypeError, - "iterator must return a tuple"); - return NULL; + if (newargs == NULL) + return NULL; + args = newargs; } result = PyObject_Call(lz->func, args, NULL); Py_DECREF(args); |