Skip to content

Commit 0e89f7a

Browse files
thesamesammgorny
andauthored
GH-113655: Lower the C recursion limit for HPPA, PPC64 and SPARC (#124264)
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 <[email protected]>
1 parent d3e79d7 commit 0e89f7a

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Include/cpython/pystate.h

+6
Original file line numberDiff line numberDiff line change
@@ -218,9 +218,15 @@ struct _ts {
218218
# define Py_C_RECURSION_LIMIT 3000
219219
#elif defined(_Py_ADDRESS_SANITIZER)
220220
# define Py_C_RECURSION_LIMIT 4000
221+
#elif defined(__sparc__)
222+
// test_descr crashed on sparc64 with >7000 but let's keep a margin of error.
223+
# define Py_C_RECURSION_LIMIT 4000
221224
#elif defined(__wasi__)
222225
// Based on wasmtime 16.
223226
# define Py_C_RECURSION_LIMIT 5000
227+
#elif defined(__hppa__) || defined(__powerpc64__)
228+
// test_descr crashed with >8000 but let's keep a margin of error.
229+
# define Py_C_RECURSION_LIMIT 5000
224230
#else
225231
// This value is duplicated in Lib/test/support/__init__.py
226232
# define Py_C_RECURSION_LIMIT 10000

0 commit comments

Comments
 (0)