From cc1c519770700ab3fe5147aa9d80f81ed42c78bc Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Sun, 4 May 2025 21:54:27 +0200 Subject: [PATCH] gh-133261: Increase C stack margin Fix a random crash in test_frame.test_repr_deep() on x86-64. --- Python/ceval.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Python/ceval.c b/Python/ceval.c index 490b653f132a6a..b276e26231ed15 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -459,7 +459,7 @@ _Py_InitializeRecursionLimits(PyThreadState *tstate) // Thread sanitizer crashes if we use a bit more than half the stack. _tstate->c_stack_soft_limit = base + (stack_size / 2); #else - _tstate->c_stack_soft_limit = base + PYOS_STACK_MARGIN_BYTES * 2; + _tstate->c_stack_soft_limit = base + PYOS_STACK_MARGIN_BYTES * 4; #endif _tstate->c_stack_hard_limit = base + PYOS_STACK_MARGIN_BYTES; assert(_tstate->c_stack_soft_limit < here_addr);