diff options
author | Amaury Forgeot d'Arc <amauryfa@gmail.com> | 2009-01-12 23:36:55 (GMT) |
---|---|---|
committer | Amaury Forgeot d'Arc <amauryfa@gmail.com> | 2009-01-12 23:36:55 (GMT) |
commit | a40d57366432cd65915b92fe3e6bfe1d5ad63be0 (patch) | |
tree | 45ef11eae7d47a373fea86cba4b1b0c4902bb93a /Modules/itertoolsmodule.c | |
parent | f94d7fa5fb90df0163cffca2864885a7da49d4f6 (diff) | |
download | cpython-a40d57366432cd65915b92fe3e6bfe1d5ad63be0.zip cpython-a40d57366432cd65915b92fe3e6bfe1d5ad63be0.tar.gz cpython-a40d57366432cd65915b92fe3e6bfe1d5ad63be0.tar.bz2 |
#3720: Interpreter crashes when an evil iterator removes its own next function.
Now the slot is filled with a function that always raises.
Will not backport: extensions compiled with 2.6.x would not run on 2.6.0.
Diffstat (limited to 'Modules/itertoolsmodule.c')
-rw-r--r-- | Modules/itertoolsmodule.c | 11 |
1 files changed, 0 insertions, 11 deletions
diff --git a/Modules/itertoolsmodule.c b/Modules/itertoolsmodule.c index 5875d10..9d6dbd9 100644 --- a/Modules/itertoolsmodule.c +++ b/Modules/itertoolsmodule.c @@ -886,7 +886,6 @@ dropwhile_next(dropwhileobject *lz) long ok; PyObject *(*iternext)(PyObject *); - assert(PyIter_Check(it)); iternext = *Py_TYPE(it)->tp_iternext; for (;;) { item = iternext(it); @@ -1031,7 +1030,6 @@ takewhile_next(takewhileobject *lz) if (lz->stop == 1) return NULL; - assert(PyIter_Check(it)); item = (*Py_TYPE(it)->tp_iternext)(it); if (item == NULL) return NULL; @@ -1218,7 +1216,6 @@ islice_next(isliceobject *lz) Py_ssize_t oldnext; PyObject *(*iternext)(PyObject *); - assert(PyIter_Check(it)); iternext = *Py_TYPE(it)->tp_iternext; while (lz->cnt < lz->next) { item = iternext(it); @@ -1229,7 +1226,6 @@ islice_next(isliceobject *lz) } if (lz->stop != -1 && lz->cnt >= lz->stop) return NULL; - assert(PyIter_Check(it)); item = iternext(it); if (item == NULL) return NULL; @@ -1361,7 +1357,6 @@ starmap_next(starmapobject *lz) PyObject *result; PyObject *it = lz->it; - assert(PyIter_Check(it)); args = (*Py_TYPE(it)->tp_iternext)(it); if (args == NULL) return NULL; @@ -2577,7 +2572,6 @@ ifilter_next(ifilterobject *lz) long ok; PyObject *(*iternext)(PyObject *); - assert(PyIter_Check(it)); iternext = *Py_TYPE(it)->tp_iternext; for (;;) { item = iternext(it); @@ -2721,7 +2715,6 @@ ifilterfalse_next(ifilterfalseobject *lz) long ok; PyObject *(*iternext)(PyObject *); - assert(PyIter_Check(it)); iternext = *Py_TYPE(it)->tp_iternext; for (;;) { item = iternext(it); @@ -3059,7 +3052,6 @@ izip_next(izipobject *lz) Py_INCREF(result); for (i=0 ; i < tuplesize ; i++) { it = PyTuple_GET_ITEM(lz->ittuple, i); - assert(PyIter_Check(it)); item = (*Py_TYPE(it)->tp_iternext)(it); if (item == NULL) { Py_DECREF(result); @@ -3075,7 +3067,6 @@ izip_next(izipobject *lz) return NULL; for (i=0 ; i < tuplesize ; i++) { it = PyTuple_GET_ITEM(lz->ittuple, i); - assert(PyIter_Check(it)); item = (*Py_TYPE(it)->tp_iternext)(it); if (item == NULL) { Py_DECREF(result); @@ -3411,7 +3402,6 @@ izip_longest_next(iziplongestobject *lz) Py_INCREF(lz->fillvalue); item = lz->fillvalue; } else { - assert(PyIter_Check(it)); item = (*Py_TYPE(it)->tp_iternext)(it); if (item == NULL) { lz->numactive -= 1; @@ -3440,7 +3430,6 @@ izip_longest_next(iziplongestobject *lz) Py_INCREF(lz->fillvalue); item = lz->fillvalue; } else { - assert(PyIter_Check(it)); item = (*Py_TYPE(it)->tp_iternext)(it); if (item == NULL) { lz->numactive -= 1; |