From c667d0669a144b20cc7a9b1a1c94e45f3b287fc7 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Tue, 9 Dec 2025 12:51:32 +0100 Subject: [PATCH] gh-140222: Increase stack margin on debug build Increase _PyOS_MIN_STACK_SIZE if Python is built in debug mode. --- Include/internal/pycore_pythonrun.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Include/internal/pycore_pythonrun.h b/Include/internal/pycore_pythonrun.h index 04a557e1204064..2a544edc431e6b 100644 --- a/Include/internal/pycore_pythonrun.h +++ b/Include/internal/pycore_pythonrun.h @@ -44,9 +44,9 @@ extern PyObject * _Py_CompileStringObjectWithModule( * no two calls to check recursion depth are more than this far * apart. In practice, that means it must be larger than the C * stack consumption of PyEval_EvalDefault */ -#if defined(_Py_ADDRESS_SANITIZER) || defined(_Py_THREAD_SANITIZER) -# define _PyOS_LOG2_STACK_MARGIN 12 -#elif defined(Py_DEBUG) && defined(WIN32) +#if (defined(Py_DEBUG) \ + || defined(_Py_ADDRESS_SANITIZER) \ + || defined(_Py_THREAD_SANITIZER)) # define _PyOS_LOG2_STACK_MARGIN 12 #else # define _PyOS_LOG2_STACK_MARGIN 11