Message158326
| Author |
rhettinger |
| Recipients |
ezio.melotti, kristjan.jonsson, pitrou, progrper, rhettinger, terry.reedy |
| Date |
2012年04月15日.13:14:19 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1334495660.29.0.71154021853.issue14507@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
The "RuntimeError: maximum recursion depth exceeded" message is normally only triggered by pure Python recursion, so I would not have expected it here, but there should be some sort of graceful MemoryError or somesuch rather than a segfault.
The following code narrows it down to some issue in starmap():
def gstarmap(func, iterable):
for tup in iterable:
yield func(*tup)
def mylist(iterable):
return [x for x in iterable]
a = b = [1]
for i in xrange(100000):
# Things that trigger a segfault:
#a = starmap(add, izip(a, b))
#a = starmap(add, iter( (a, b) ))
a = starmap(add, (a, b) )
# Things that exit cleanly with a RuntimeError
#a = gstarmap(add, iter( (a, b) ))
#a = (x+y for x, y in iter( (a, b) ))
mylist(a)
One possibility may be that starmap.next needs to clear StopIteration exceptions in the same way as PyIter_Next():
if (result == NULL &&
PyErr_Occurred() &&
PyErr_ExceptionMatches(PyExc_StopIteration))
PyErr_Clear(); |
|