GH-91079: Revert "GH-91079: Implement C stack limits using addresses, not counters. (GH-130007)" for now (GH130413)

Revert "GH-91079: Implement C stack limits using addresses, not counters. (GH-130007)" for now

Unfortunatlely, the change broke some buildbots.

This reverts commit 2498c22fa0.
This commit is contained in:
Petr Viktorin 2025-02-24 11:16:08 +01:00 committed by GitHub
parent 0ff1611574
commit ef29104f7d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
47 changed files with 1466 additions and 1220 deletions

View file

@ -115,11 +115,7 @@ static PyObject*
get_c_recursion_remaining(PyObject *self, PyObject *Py_UNUSED(args))
{
PyThreadState *tstate = _PyThreadState_GET();
char here;
uintptr_t here_addr = (uintptr_t)&here;
_PyThreadStateImpl *_tstate = (_PyThreadStateImpl *)tstate;
int remaining = (int)((here_addr - _tstate->c_stack_soft_limit)/PYOS_STACK_MARGIN_BYTES * 50);
return PyLong_FromLong(remaining);
return PyLong_FromLong(tstate->c_recursion_remaining);
}