summaryrefslogtreecommitdiffstats
path: root/Objects/abstract.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2013-04-06 18:20:30 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2013-04-06 18:20:30 (GMT)
commitaac81e2780a181f4076190a28cde3e4bfaab614b (patch)
tree1886a2923e5959ce59f294558ba2122c3497366c /Objects/abstract.c
parentc53fd51278fe37a8d57968267452bf06d8db609c (diff)
parente8f706eda77db200728fc436dca20f0591eeec27 (diff)
downloadcpython-aac81e2780a181f4076190a28cde3e4bfaab614b.zip
cpython-aac81e2780a181f4076190a28cde3e4bfaab614b.tar.gz
cpython-aac81e2780a181f4076190a28cde3e4bfaab614b.tar.bz2
Issue #14010: Fix a crash when iterating or deleting deeply nested filters
(builting and in itertools module, i.e. map(), itertools.chain(), etc).
Diffstat (limited to 'Objects/abstract.c')
-rw-r--r--Objects/abstract.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/Objects/abstract.c b/Objects/abstract.c
index 4326cfa..9b31d7a 100644
--- a/Objects/abstract.c
+++ b/Objects/abstract.c
@@ -1238,7 +1238,7 @@ PyNumber_AsSsize_t(PyObject *item, PyObject *err)
to be an int or have an __int__ method. Steals integral's
reference. error_format will be used to create the TypeError if integral
isn't actually an Integral instance. error_format should be a format string
- that can accept a char* naming integral's type.
+ that can accept a char* naming integral's type.
*/
static PyObject *
convert_integral_to_int(PyObject *integral, const char *error_format)
@@ -1257,7 +1257,7 @@ convert_integral_to_int(PyObject *integral, const char *error_format)
}
PyErr_Format(PyExc_TypeError, error_format, Py_TYPE(integral)->tp_name);
Py_DECREF(integral);
- return NULL;
+ return NULL;
}
@@ -2702,7 +2702,10 @@ PyObject *
PyIter_Next(PyObject *iter)
{
PyObject *result;
+ if (Py_EnterRecursiveCall(" while iterating"))
+ return NULL;
result = (*iter->ob_type->tp_iternext)(iter);
+ Py_LeaveRecursiveCall();
if (result == NULL &&
PyErr_Occurred() &&
PyErr_ExceptionMatches(PyExc_StopIteration))