diff options
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 132acc5..d35c6b9 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); |