[Python-Dev] Re: sre vs gcc (was: New re failures on Windows)

Andrew MacIntyre andymac@bullseye.apana.org.au
Wed, 23 Apr 2003 10:52:19 +1100 (edt)


On Tue, 22 Apr 2003, Gary Herron wrote:

> On Tuesday 22 April 2003 01:27 am, Andrew MacIntyre wrote:

{...}

> > The actual test case from test_sre that fails is:
> > ---8<---8<---
> > # non-simple '*?' still recurses and hits the recursion limit
> > test(r"""sre.search('(a|b)*?c', 10000*'ab'+'cd').end(0)""", None,
> > RuntimeError) ---8<---8<---

{...}

> Ah.  Good clue!  Here's a very likely fix to that problem.  Around
> line 3102 of _sre.c find the line that sets USE_RECURSION_LIMIT.
> Depending on you platform it will be set to either 10000 or 7500.  As
> a test, lower that value to 1000 or even 100.  If all the tests pass,
> then we know the culprit.

The magic number for USE_RECURSION_LIMIT is between 9250 & 9500.

Note that this is for gcc 3.2.2 on FreeBSD 4.7.  For gcc 3.2.1 on OS/2,
9250 is too high, but 7500 lets test_sre complete.

If the above test case is commented out, the "Test engine limitations"
test case section fails at the same USE_RECURSION_LIMIT settings as the
above test case.

I'll prepare a patch to supercede 725024 which sets USE_RECURSION_LIMIT to
7500 on FreeBSD & OS/2 with gcc 3.x, but I won't get to it for a day or
two.  I'll assign it to Gustavo.

--
Andrew I MacIntyre                     "These thoughts are mine alone..."
E-mail: andymac@bullseye.apana.org.au  | Snail: PO Box 370
        andymac@pcug.org.au            |        Belconnen  ACT  2616
Web:    http://www.andymac.org/        |        Australia