[Python-Dev] Re: re recursion limit

Gary Herron gherron@islandtraining.com
Wed, 26 Feb 2003 14:05:42 -0800


On Wednesday 26 February 2003 01:57 pm, A.M. Kuchling wrote:
> Gary Herron wrote:
> > What to do about RE's that hit the recursion limit?
>
> I haven't had a chance to look at the SRE code in detail yet, but expect
> that the problem is that the straightforward way to implement .*? is
> with a C function call.  PCRE also implemented it with a function call;
> Python avoided the limit by forking PCRE and adding a heap-allocated
> stack and pushing states onto the stack instead of recursing, which is
> why pre avoids the
> recursion limit (well, until you fill up your entire heap).
>
> The problem is that the patches to do this were extensive and ugly.
> Maybe just fixing the problem for .* will be sufficient.

Actually .* does not seem to have this recursion problem, only .*? --
I don't yet know why.

> Incidentally, before we go making lots of changes, has anyone actually
> pinged Fredrik about the SRE code?  His usual approach with software is
> to process patches and TODO items every N months; maybe he just hasn't
> gotten around to looking at the SRE backlog?

I sent a copy of my original post to him.  I've had no response yet,
but it's been less than a day.

Gary Herron