]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Backport 2.3 FreeBSD recursion_limit settings. Fixes #553736.
authorMartin v. Löwis <martin@v.loewis.de>
Sat, 14 Jun 2003 15:05:13 +0000 (15:05 +0000)
committerMartin v. Löwis <martin@v.loewis.de>
Sat, 14 Jun 2003 15:05:13 +0000 (15:05 +0000)
Modules/_sre.c

index 308b7260b57f96fa7c4e3fd93e02f03849cc397d..a83cdcf46c42ab7b7b274d0f1000825161be6e5f 100644 (file)
@@ -75,10 +75,24 @@ static char copyright[] =
    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
+#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