summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2009-09-06 22:43:39 (GMT)
committerBenjamin Peterson <benjamin@python.org>2009-09-06 22:43:39 (GMT)
commit5515990ee1fbe48774dea9fe04d80385a1bf42f2 (patch)
treeadb75543e3e3617e88a38697fdf9cd23af5658da /Python
parent6b3f1ef190bc89c4fcc5dbfdc3ca1cc15d5e6acc (diff)
downloadcpython-5515990ee1fbe48774dea9fe04d80385a1bf42f2.zip
cpython-5515990ee1fbe48774dea9fe04d80385a1bf42f2.tar.gz
cpython-5515990ee1fbe48774dea9fe04d80385a1bf42f2.tar.bz2
PyObject_GetIter can set an error for its self just fine
Diffstat (limited to 'Python')
-rw-r--r--Python/bltinmodule.c15
1 files changed, 2 insertions, 13 deletions
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c
index 1f25d5d..b1b1e8e 100644
--- a/Python/bltinmodule.c
+++ b/Python/bltinmodule.c
@@ -968,14 +968,8 @@ builtin_map(PyObject *self, PyObject *args)
/* Get iterator. */
curseq = PyTuple_GetItem(args, i+1);
sqp->it = PyObject_GetIter(curseq);
- if (sqp->it == NULL) {
- static char errmsg[] =
- "argument %d to map() must support iteration";
- char errbuf[sizeof(errmsg) + 25];
- PyOS_snprintf(errbuf, sizeof(errbuf), errmsg, i+2);
- PyErr_SetString(PyExc_TypeError, errbuf);
+ if (sqp->it == NULL)
goto Fail_2;
- }
/* Update len. */
curlen = _PyObject_LengthHint(curseq, 8);
@@ -2463,13 +2457,8 @@ builtin_zip(PyObject *self, PyObject *args)
for (i = 0; i < itemsize; ++i) {
PyObject *item = PyTuple_GET_ITEM(args, i);
PyObject *it = PyObject_GetIter(item);
- if (it == NULL) {
- if (PyErr_ExceptionMatches(PyExc_TypeError))
- PyErr_Format(PyExc_TypeError,
- "zip argument #%zd must support iteration",
- i+1);
+ if (it == NULL)
goto Fail_ret_itlist;
- }
PyTuple_SET_ITEM(itlist, i, it);
}