diff options
Diffstat (limited to 'Python/bltinmodule.c')
-rw-r--r-- | Python/bltinmodule.c | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c index 314fb4e..7fc6f57 100644 --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -791,17 +791,13 @@ builtin_map(PyObject *self, PyObject *args) } /* Update len. */ - curlen = -1; /* unknown */ - if (PySequence_Check(curseq) && - curseq->ob_type->tp_as_sequence->sq_length) { - curlen = PySequence_Size(curseq); - if (curlen < 0) - PyErr_Clear(); - } - if (curlen < 0) + curlen = PyObject_Size(curseq); + if (curlen < 0) { + PyErr_Clear(); curlen = 8; /* arbitrary */ - if (curlen > len) - len = curlen; + } + if (curlen > len) + len = curlen; } /* Get space for the result list. */ @@ -1968,7 +1964,7 @@ builtin_zip(PyObject *self, PyObject *args) len = -1; /* unknown */ for (i = 0; i < itemsize; ++i) { PyObject *item = PyTuple_GET_ITEM(args, i); - int thislen = PySequence_Length(item); + int thislen = PyObject_Size(item); if (thislen < 0) { PyErr_Clear(); len = -1; |