[Python-Dev] FW: regarding the Python Developer posting...

Fredrik Lundh Fredrik Lundh" <effbot@telia.com
Wed, 27 Sep 2000 10:06:44 +0200


dan wrote:
> >[Tim: use the current CVS tree instead... code's been replace...]
> 
> duh! gotta read them archives before seeing following up on an request... 
> can't trust the hyper-active Python development team with a code 
> freeze.... <wink>

heh.  your bug report was the main reason for getting this change
into 2.0b2, and we completely forgot to tell you about it...

> Unfortuantely, test_re.py now seg faults.... which is caused by 
> test_sre.py... in particular the following:
> 
> src/Lib/test/test_sre.py
> 
> if verbose:
>     print 'Test engine limitations'
> 
> # Try nasty case that overflows the straightforward recursive
> # implementation of repeated groups.
> #test(r"""sre.match(r'(x)*', 50000*'x').span()""",
> #   (0, 50000), RuntimeError)
> #test(r"""sre.match(r'(x)*y', 50000*'x'+'y').span()""",
> #     (0, 50001), RuntimeError)
> #test(r"""sre.match(r'(x)*?y', 50000*'x'+'y').span()""",
> #     (0, 50001), RuntimeError)

umm.  I assume it bombs if you uncomment those lines, right?

you could try adding a Mac OS clause to the recursion limit stuff
in Modules/_sre.c:

#if !defined(USE_STACKCHECK)
#if defined(...whatever's needed to detect Max OS X...)
#define USE_RECURSION_LIMIT 5000
#elif defined(MS_WIN64) || defined(__LP64__) || defined(_LP64)
/* require smaller recursion limit for a number of 64-bit platforms:
   Win64 (MS_WIN64), Linux64 (__LP64__), Monterey (64-bit AIX) (_LP64) */
/* FIXME: maybe the limit should be 40000 / sizeof(void*) ? */
#define USE_RECURSION_LIMIT 7500
#else
#define USE_RECURSION_LIMIT 10000
#endif
#endif

replace "...whatever...", and try larger values than 5000 (or smaller,
if necessary.  10000 is clearly too large for your platform).

(alternatively, you can increase the stack size.  maybe it's very small
by default?)

</F>