mirror of
https://github.com/python/cpython.git
synced 2025-07-15 15:25:29 +00:00
SF patch 1546297 (with some tweaks):
Create a real zip iterator object; not using itertools.izip (Brian Holmes).
This commit is contained in:
parent
e2e23ef97d
commit
b65fb33b02
3 changed files with 177 additions and 15 deletions
|
@ -1855,22 +1855,10 @@ is a shortcut for issubclass(X, A) or issubclass(X, B) or ... (etc.).");
|
|||
static PyObject*
|
||||
builtin_zip(PyObject *self, PyObject *args)
|
||||
{
|
||||
PyObject *itertools = NULL, *izip = NULL, *result = NULL;
|
||||
/* args must be a tuple */
|
||||
assert(PyTuple_Check(args));
|
||||
|
||||
itertools = PyImport_ImportModule("itertools");
|
||||
if (itertools == NULL)
|
||||
return NULL;
|
||||
|
||||
izip = PyObject_GetAttrString(itertools, "izip");
|
||||
if (izip == NULL)
|
||||
goto done;
|
||||
|
||||
result = PyObject_Call(izip, args, NULL);
|
||||
|
||||
done:
|
||||
Py_XDECREF(itertools);
|
||||
Py_XDECREF(izip);
|
||||
return result;
|
||||
return _PyZip_CreateIter(args);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue