mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
GH-139914: Handle stack growth direction on HPPA (GH-140028)
Adapted from a patch for Python 3.14 submitted to the Debian BTS by John https://bugs.debian.org/1105111#20 Co-authored-by: John David Anglin <dave.anglin@bell.net>
This commit is contained in:
parent
336366fd7c
commit
f6dd9c12a8
10 changed files with 94 additions and 5 deletions
|
|
@ -331,7 +331,11 @@ _Py_RecursionLimit_GetMargin(PyThreadState *tstate)
|
|||
_PyThreadStateImpl *_tstate = (_PyThreadStateImpl *)tstate;
|
||||
assert(_tstate->c_stack_hard_limit != 0);
|
||||
intptr_t here_addr = _Py_get_machine_stack_pointer();
|
||||
#if _Py_STACK_GROWS_DOWN
|
||||
return Py_ARITHMETIC_RIGHT_SHIFT(intptr_t, here_addr - (intptr_t)_tstate->c_stack_soft_limit, _PyOS_STACK_MARGIN_SHIFT);
|
||||
#else
|
||||
return Py_ARITHMETIC_RIGHT_SHIFT(intptr_t, (intptr_t)_tstate->c_stack_soft_limit - here_addr, _PyOS_STACK_MARGIN_SHIFT);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue