We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4434b24 commit b217e3fCopy full SHA for b217e3f
Include/internal/pycore_pystate.h
@@ -326,7 +326,11 @@ _Py_RecursionLimit_GetMargin(PyThreadState *tstate)
326
_PyThreadStateImpl *_tstate = (_PyThreadStateImpl *)tstate;
327
assert(_tstate->c_stack_hard_limit != 0);
328
intptr_t here_addr = _Py_get_machine_stack_pointer();
329
+#if _Py_STACK_GROWS_DOWN
330
return Py_ARITHMETIC_RIGHT_SHIFT(intptr_t, here_addr - (intptr_t)_tstate->c_stack_soft_limit, _PyOS_STACK_MARGIN_SHIFT);
331
+#else
332
+ return Py_ARITHMETIC_RIGHT_SHIFT(intptr_t, (intptr_t)_tstate->c_stack_soft_limit - here_addr, _PyOS_STACK_MARGIN_SHIFT);
333
+#endif
334
}
335
336
#ifdef __cplusplus
0 commit comments