mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
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.
This commit is contained in:
parent
0dda40035f
commit
1a44448b24
1 changed files with 11 additions and 5 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue