summaryrefslogtreecommitdiffstats
path: root/Python/ceval.c
diff options
context:
space:
mode:
authorpdox <pdox@alum.mit.edu>2017-10-26 06:03:01 (GMT)
committerBenjamin Peterson <benjamin@python.org>2017-10-26 06:03:01 (GMT)
commit1896793520a49a6f97ae360c0b288967e56b005e (patch)
treeb757b6b4691e52d5f3d22177ac23de50ad7d1d25 /Python/ceval.c
parent32318930da70ff03320ec50813b843e7db6fbc2e (diff)
downloadcpython-1896793520a49a6f97ae360c0b288967e56b005e.zip
cpython-1896793520a49a6f97ae360c0b288967e56b005e.tar.gz
cpython-1896793520a49a6f97ae360c0b288967e56b005e.tar.bz2
bpo-31857: Make the behavior of USE_STACKCHECK deterministic (#4098)
Diffstat (limited to 'Python/ceval.c')
-rw-r--r--Python/ceval.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index 58a2513..f6519cf 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;