summaryrefslogtreecommitdiff
path: root/Python
diff options
context:
space:
mode:
Diffstat (limited to 'Python')
-rw-r--r--Python/ceval.c4
-rw-r--r--Python/pystate.c1
2 files changed, 4 insertions, 1 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index 58a2513b3e..f6519cff59 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -469,13 +469,15 @@ _Py_CheckRecursiveCall(const char *where)
int recursion_limit = _PyRuntime.ceval.recursion_limit;
#ifdef USE_STACKCHECK
+ tstate->stackcheck_counter = 0;
if (PyOS_CheckStack()) {
--tstate->recursion_depth;
PyErr_SetString(PyExc_MemoryError, "Stack overflow");
return -1;
}
-#endif
+ /* Needed for ABI backwards-compatibility (see bpo-31857) */
_Py_CheckRecursionLimit = recursion_limit;
+#endif
if (tstate->recursion_critical)
/* Somebody asked that we don't check for recursion. */
return 0;
diff --git a/Python/pystate.c b/Python/pystate.c
index d85d604de5..82ebf4da7d 100644
--- a/Python/pystate.c
+++ b/Python/pystate.c
@@ -245,6 +245,7 @@ new_threadstate(PyInterpreterState *interp, int init)
tstate->recursion_depth = 0;
tstate->overflowed = 0;
tstate->recursion_critical = 0;
+ tstate->stackcheck_counter = 0;
tstate->tracing = 0;
tstate->use_tracing = 0;
tstate->gilstate_counter = 0;