summaryrefslogtreecommitdiff
path: root/Include
diff options
context:
space:
mode:
authorAmaury Forgeot d'Arc <amauryfa@gmail.com>2009-01-12 23:36:55 +0000
committerAmaury Forgeot d'Arc <amauryfa@gmail.com>2009-01-12 23:36:55 +0000
commit0b3185c156c2ec1f12c729cae06942318f83fa74 (patch)
treeab9be8702a8b8dcb43151c4b800dccf228003f8a /Include
parent4c0d0e34f48c607faf26aa0062a878336f135526 (diff)
downloadcpython-0b3185c156c2ec1f12c729cae06942318f83fa74.tar.gz
#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 'Include')
-rw-r--r--Include/abstract.h3
-rw-r--r--Include/object.h1
2 files changed, 3 insertions, 1 deletions
diff --git a/Include/abstract.h b/Include/abstract.h
index f3bc8bcd0f..87afe9a640 100644
--- a/Include/abstract.h
+++ b/Include/abstract.h
@@ -636,7 +636,8 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
#define PyIter_Check(obj) \
(PyType_HasFeature((obj)->ob_type, Py_TPFLAGS_HAVE_ITER) && \
- (obj)->ob_type->tp_iternext != NULL)
+ (obj)->ob_type->tp_iternext != NULL && \
+ (obj)->ob_type->tp_iternext != &_PyObject_NextNotImplemented)
PyAPI_FUNC(PyObject *) PyIter_Next(PyObject *);
/* Takes an iterator object and calls its tp_iternext slot,
diff --git a/Include/object.h b/Include/object.h
index b02689cc4a..c40d36201d 100644
--- a/Include/object.h
+++ b/Include/object.h
@@ -473,6 +473,7 @@ PyAPI_FUNC(int) PyObject_SetAttr(PyObject *, PyObject *, PyObject *);
PyAPI_FUNC(int) PyObject_HasAttr(PyObject *, PyObject *);
PyAPI_FUNC(PyObject **) _PyObject_GetDictPtr(PyObject *);
PyAPI_FUNC(PyObject *) PyObject_SelfIter(PyObject *);
+PyAPI_FUNC(PyObject *) _PyObject_NextNotImplemented(PyObject *);
PyAPI_FUNC(PyObject *) PyObject_GenericGetAttr(PyObject *, PyObject *);
PyAPI_FUNC(int) PyObject_GenericSetAttr(PyObject *,
PyObject *, PyObject *);