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

@ -653,6 +653,7 @@ def has_error_without_pop(op: parser.CodeDef) -> bool:
"_PyUnicode_JoinArray",
"_Py_CHECK_EMSCRIPTEN_SIGNALS_PERIODICALLY",
"_Py_DECREF_NO_DEALLOC",
"_Py_EnterRecursiveCallTstateUnchecked",
"_Py_ID",
"_Py_IsImmortal",
"_Py_LeaveRecursiveCallPy",
@ -672,7 +673,6 @@ def has_error_without_pop(op: parser.CodeDef) -> bool:
"initial_temperature_backoff_counter",
"JUMP_TO_LABEL",
"restart_backoff_counter",
"_Py_ReachedRecursionLimit",
)
def find_stmt_start(node: parser.CodeDef, idx: int) -> lexer.Token:

View file

@ -44,7 +44,7 @@
# define MAXSTACK 4000
# endif
#else
# define MAXSTACK 4000
# define MAXSTACK 6000
#endif
"""
@ -380,7 +380,7 @@ def __init__(
self.cleanup_statements: List[str] = []
def add_level(self) -> None:
self.print("if (p->level++ == MAXSTACK || _Py_ReachedRecursionLimitWithMargin(PyThreadState_Get(), 1)) {")
self.print("if (p->level++ == MAXSTACK) {")
with self.indent():
self.print("_Pypegen_stack_overflow(p);")
self.print("}")