diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2013-04-06 18:14:43 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2013-04-06 18:14:43 (GMT) |
commit | e8f706eda77db200728fc436dca20f0591eeec27 (patch) | |
tree | 7f47f633fb9714389be706b84bc3ceb0559aae1a /Objects/abstract.c | |
parent | e16f4dc80ac71bea48c60d4620740d74975024c9 (diff) | |
download | cpython-e8f706eda77db200728fc436dca20f0591eeec27.zip cpython-e8f706eda77db200728fc436dca20f0591eeec27.tar.gz cpython-e8f706eda77db200728fc436dca20f0591eeec27.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.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Objects/abstract.c b/Objects/abstract.c index a2737dd..77a16c9 100644 --- a/Objects/abstract.c +++ b/Objects/abstract.c @@ -1217,7 +1217,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) @@ -1236,7 +1236,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; } @@ -2681,7 +2681,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)) |