This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

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();
History
Date User Action Args
2012-04-15 13:14:20rhettingersetrecipients: + rhettinger, terry.reedy, pitrou, kristjan.jonsson, ezio.melotti, progrper
2012-04-15 13:14:20rhettingersetmessageid: <1334495660.29.0.71154021853.issue14507@psf.upfronthosting.co.za>
2012-04-15 13:14:19rhettingerlinkissue14507 messages
2012-04-15 13:14:19rhettingercreate