]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.14] gh-140222: Increase stack margin on debug build (GH-142452) (#142471)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Tue, 9 Dec 2025 15:59:42 +0000 (16:59 +0100)
committerGitHub <noreply@github.com>
Tue, 9 Dec 2025 15:59:42 +0000 (15:59 +0000)
gh-140222: Increase stack margin on debug build (GH-142452)

Increase _PyOS_MIN_STACK_SIZE if Python is built in debug mode.
(cherry picked from commit 49207a522627718a19886386ec2a7ce957437d08)

Co-authored-by: Victor Stinner <vstinner@python.org>
Include/internal/pycore_pythonrun.h

index b232429c4d09c31a683af61f2c0adbd7b17a0a96..b25abb4f64c688f095b538c1cf61e7eb4513429b 100644 (file)
@@ -38,9 +38,9 @@ extern const char* _Py_SourceAsString(
  * 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