Test error with Python 2.3.4c1

Andrew MacIntyre andymac at bullseye.apana.org.au
Mon May 17 09:11:05 EDT 2004


On Sun, 16 May 2004, Berthold Höllmann wrote:

> > caused some changes to the way sre operates, so it was a non-starter for
> > the 2.3.x series.
> >
> > Anyway, please close your bug with a note about it being fixed in 2.4
> > CVS.  As for the other issue, I don't have enough time/energy to even
> > understand what the issue is.  Given that it's about SAX, I suggest you
> > start a new thread and hopefully someone else will pick it up.
>
> OK, I closed the bug, but still would like to see USE_RECURSION_LIMIT
> default reduced to something like 6500 (3000 seems to be OK for
> FreeBSD on sparc64, so I guess this can't be a behavioral change).

Prior to 2.4, sre is recursive.  Recent versions of gcc (in particular)
at higher optimisation levels are generating much larger stack frames than
used to be the case.  This is even moreso the case with 64-bit platforms.

In the particular case of FreeBSD 4.x, in the presence of threads (the
default build choice, using libc_r) there is a hard coded stack size of
1MB, which leaves this environment especially sensitive to stack frame
size.  The alternative threads libraries (libkse/libthr) available on 5.x
are less affected, but I don't know to what extent (& Python's configure
script doesn't know about them that I've heard).

I've seen reference to the problem on Linux, but I don't know why that
platform is (apparently) short on stack.

This is a highly platform/compiler dependant issue, which is why the maze
of #ifdef'ery for USE_RECURSION_LIMIT - something that has only happened
since about Python 2.3.1 as I recall.

The most effective solution with recent gcc versions is to recompile sre.c
with -Os (instead of -O3).  It is unfortunately awkward to implement with
autoconf.  The non-recursive sre in 2.4 is a complete fix, but is too
extensive/invasive a change for back-porting for a bug-fix release.

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




More information about the Python-list mailing list