From 0e89f7abd494bd6c658083c1c1d50a640a1f2309 Mon Sep 17 00:00:00 2001 From: Sam James Date: Mon, 23 Sep 2024 08:03:30 +0100 Subject: GH-113655: Lower the C recursion limit for HPPA, PPC64 and SPARC (#124264) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Lower the C recursion limit for HPPA, PPC64 and SPARC, as they use relatively large stack frames that cause e.g. `test_descr` to hit a stack overflow. According to quick testing, it seems that values around 8000 are max for HPPA and PPC64 (ELFv1 ABI) and 7000 for SPARC64. To keep things safe, let's use 5000 for PPC64 and 4000 for SPARC. Co-authored-by: Michał Górny --- Include/cpython/pystate.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Include/cpython/pystate.h b/Include/cpython/pystate.h index f005729..32f6837 100644 --- a/Include/cpython/pystate.h +++ b/Include/cpython/pystate.h @@ -218,9 +218,15 @@ struct _ts { # define Py_C_RECURSION_LIMIT 3000 #elif defined(_Py_ADDRESS_SANITIZER) # define Py_C_RECURSION_LIMIT 4000 +#elif defined(__sparc__) + // test_descr crashed on sparc64 with >7000 but let's keep a margin of error. +# define Py_C_RECURSION_LIMIT 4000 #elif defined(__wasi__) // Based on wasmtime 16. # define Py_C_RECURSION_LIMIT 5000 +#elif defined(__hppa__) || defined(__powerpc64__) + // test_descr crashed with >8000 but let's keep a margin of error. +# define Py_C_RECURSION_LIMIT 5000 #else // This value is duplicated in Lib/test/support/__init__.py # define Py_C_RECURSION_LIMIT 10000 -- cgit v0.12