diff options
author | Andrew MacIntyre <andymac@bullseye.apana.org.au> | 2003-06-09 08:22:11 (GMT) |
---|---|---|
committer | Andrew MacIntyre <andymac@bullseye.apana.org.au> | 2003-06-09 08:22:11 (GMT) |
commit | 1a44448b24cae0d99aa0556448442dae99604cd7 (patch) | |
tree | 7120b8c1e3ac1fc5602be31fc9816f57e386ad74 | |
parent | 0dda40035f46579bebb2e72c86d547a573c631a2 (diff) | |
download | cpython-1a44448b24cae0d99aa0556448442dae99604cd7.zip cpython-1a44448b24cae0d99aa0556448442dae99604cd7.tar.gz cpython-1a44448b24cae0d99aa0556448442dae99604cd7.tar.bz2 |
Changes to sre.c after the application of patch #726869 have increased
stack usage on FreeBSD, requiring the recursion limit to be lowered
further. Building with gcc 2.95 (the standard compiler on FreeBSD 4.x)
is now also affected.
The underlying issue is that FreeBSD's pthreads implementation has a
hard-coded 1MB stack size for the initial (or "primary") thread, which
can not be changed without rebuilding libc_r. Exhausting this stack
results in a bus error.
Building without pthreads (configure --without-threads), or linking
with the port of the Linux pthreads library (aka Linuxthreads) instead
of libc_r, avoids this limitation.
On OS/2, only gcc 3.2 is affected and the stack size is controllable,
so the special handling has been removed.
-rw-r--r-- | Modules/_sre.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/Modules/_sre.c b/Modules/_sre.c index 8203ac8..3f9a2d3 100644 --- a/Modules/_sre.c +++ b/Modules/_sre.c @@ -72,13 +72,19 @@ static char copyright[] = /* FIXME: maybe the limit should be 40000 / sizeof(void*) ? */ #define USE_RECURSION_LIMIT 7500 #else -#if defined(__GNUC__) && (__GNUC__ > 2) && \ - (defined(__FreeBSD__) || defined(PYOS_OS2)) -/* gcc 3.x, on FreeBSD and OS/2+EMX and at optimisation levels of - * -O3 (autoconf default) and -O2 (EMX port default), generates code - * for _sre that fails for the default recursion limit. + +#if defined(__GNUC__) && defined(WITH_THREAD) && defined(__FreeBSD__) +/* the pthreads library on FreeBSD has a fixed 1MB stack size for the + * initial (or "primary") thread, which is insufficient for the default + * recursion limit. gcc 3.x at the default optimisation + * level (-O3) uses stack space more aggressively than gcc 2.95. */ +#if (__GNUC__ > 2) +#define USE_RECURSION_LIMIT 6500 +#else #define USE_RECURSION_LIMIT 7500 +#endif + #else #define USE_RECURSION_LIMIT 10000 #endif |