Detecting repeated subsequences of identical items

Chris Angelico rosuav at gmail.com
Thu Apr 21 10:12:23 EDT 2016


On Fri, Apr 22, 2016 at 12:01 AM, Oscar Benjamin
<oscar.j.benjamin at gmail.com> wrote:
> In the recursive stack overflow case what you'll usually have is
>
> 1) A few frames leading up to the start of recursion
> 2) A long repetitive sequence of frames
> 3) A few frames at the end showing how the exception was ultimately triggered.
>
> You just need to find the cycle that makes that big long sequence.

If the stack got overflowed, there won't usually be a part 3, as part
2 is the bit that hits sys.recursionlimit (unless increasing the
recursion limit by a finite number would solve the problem). For other
exceptions, yes, this is what you'd see.

ChrisA



More information about the Python-list mailing list