We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1908115 commit 4162bc1Copy full SHA for 4162bc1
Python/ceval.c
@@ -392,7 +392,12 @@ _Py_InitializeRecursionLimits(PyThreadState *tstate)
392
if (err == 0) {
393
uintptr_t base = ((uintptr_t)stack_addr) + guard_size;
394
_tstate->c_stack_top = base + stack_size;
395
+#ifdef _Py_THREAD_SANITIZER
396
+ // Thread sanitizer crashes if we use a bit more than half the stack.
397
+ _tstate->c_stack_soft_limit = base + (stack_size / 2);
398
+#else
399
_tstate->c_stack_soft_limit = base + PYOS_STACK_MARGIN_BYTES * 2;
400
+#endif
401
_tstate->c_stack_hard_limit = base + PYOS_STACK_MARGIN_BYTES;
402
assert(_tstate->c_stack_soft_limit < here_addr);
403
assert(here_addr < _tstate->c_stack_top);
0 commit comments