summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2003-06-14 15:05:13 +0000
committerMartin v. Löwis <martin@v.loewis.de>2003-06-14 15:05:13 +0000
commitcee0863371dc582772a512c358d38fe37876a30e (patch)
tree5d5f3e6680ec7a1062d50862ce0a52098c7d58cb
parent588c7f4168c3fb0ac16321bfd61f90ca640ea322 (diff)
downloadcpython-cee0863371dc582772a512c358d38fe37876a30e.tar.gz
Backport 2.3 FreeBSD recursion_limit settings. Fixes #553736.
-rw-r--r--Modules/_sre.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/Modules/_sre.c b/Modules/_sre.c
index 308b7260b5..a83cdcf46c 100644
--- a/Modules/_sre.c
+++ b/Modules/_sre.c
@@ -76,9 +76,23 @@ static char copyright[] =
/* FIXME: maybe the limit should be 40000 / sizeof(void*) ? */
#define USE_RECURSION_LIMIT 7500
#else
+#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
#endif
+#endif
/* enables fast searching */
#define USE_FAST_SEARCH