[Python-bugs-list] [ python-Bugs-416526 ] Regular expression tests: SEGV on Mac OS

noreply@sourceforge.net noreply@sourceforge.net
Thu, 26 Apr 2001 15:01:47 -0700


Bugs item #416526, was updated on 2001-04-16 14:09
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=416526&group_id=5470

Category: Regular Expressions
Group: Platform-specific
Status: Open
Resolution: None
Priority: 7
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Fredrik Lundh (effbot)
Summary: Regular expression tests: SEGV on Mac OS

Initial Comment:
The regular expression regression tests 'test_re' 
causes a SEGV failure on Mac OS X version 10.0.1 
when using Python 2.1c2 (and earlier). This is 
caused by the test trying to recurse 50,000 levels 
deep.

Workaround: A workaround is to limit how deep the 
regular expression library can recurse (this is 
already done for Win32). This can be achieved by 
changing file './Modules/_sre.c' using the following 
patch:

--- ./orig/_sre.c   Sun Apr 15 19:00:58 2001
+++ ./new/_sre.c    Mon Apr 16 21:39:29 2001
@@ -75,6 +75,9 @@
    Win64 (MS_WIN64), Linux64 (__LP64__), 
Monterey (64-bit AIX) (_LP64) */
 /* FIXME: maybe the limit should be 40000 / 
sizeof(void*) ? */
 #define USE_RECURSION_LIMIT 7500
+#elif defined(__APPLE_CC__)
+/* Apple 'cc' compiler eg. for Mac OS X */
+#define USE_RECURSION_LIMIT 4000
 #else
 #define USE_RECURSION_LIMIT 10000
 #endif


----------------------------------------------------------------------

>Comment By: Fredrik Lundh (effbot)
Date: 2001-04-26 15:01

Message:
Logged In: YES 
user_id=38376

An alternate (and perhaps better) workaround could be
to increase the stack size on Mac OS X.

But in either case, my plan is to get rid of the recursion
limit in 2.2 (stackless SRE may still run out of memory,
but it shouldn't have to run out of stack).

Cheers /F

----------------------------------------------------------------------

Comment By: Dan Wolfe (dkwolfe)
Date: 2001-04-17 16:52

Message:
Logged In: YES 
user_id=80173

Instead of relying on a compiler variable, we should probably 
set a environment variable as part of the ./configure and use 
that to determine when to reduce the USE_RECURSION_LIMIT.


----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=416526&group_id=5470