summaryrefslogtreecommitdiffstats
path: root/Python/sysmodule.c
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2021-11-19 18:51:50 (GMT)
committerGitHub <noreply@github.com>2021-11-19 18:51:50 (GMT)
commit4296396db017d782d3aa16100b366748c9ea4a04 (patch)
treea3b5228ac4881bfb74ea10646781bad1b9f15be7 /Python/sysmodule.c
parentc06c7c489a82b2db023bb947f0c4d21ad93b8308 (diff)
downloadcpython-4296396db017d782d3aa16100b366748c9ea4a04.zip
cpython-4296396db017d782d3aa16100b366748c9ea4a04.tar.gz
cpython-4296396db017d782d3aa16100b366748c9ea4a04.tar.bz2
[3.9] bpo-45806: Fix recovery from stack overflow for 3.9. Again. (GH-29640)
Co-authored-by: Ɓukasz Langa <lukasz@langa.pl>
Diffstat (limited to 'Python/sysmodule.c')
-rw-r--r--Python/sysmodule.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/Python/sysmodule.c b/Python/sysmodule.c
index 3e4115f..a52b299 100644
--- a/Python/sysmodule.c
+++ b/Python/sysmodule.c
@@ -17,7 +17,7 @@ Data members:
#include "Python.h"
#include "code.h"
#include "frameobject.h" // PyFrame_GetBack()
-#include "pycore_ceval.h" // _Py_RecursionLimitLowerWaterMark()
+#include "pycore_ceval.h"
#include "pycore_initconfig.h"
#include "pycore_object.h"
#include "pycore_pathconfig.h"
@@ -1160,7 +1160,6 @@ static PyObject *
sys_setrecursionlimit_impl(PyObject *module, int new_limit)
/*[clinic end generated code: output=35e1c64754800ace input=b0f7a23393924af3]*/
{
- int mark;
PyThreadState *tstate = _PyThreadState_GET();
if (new_limit < 1) {
@@ -1178,8 +1177,7 @@ sys_setrecursionlimit_impl(PyObject *module, int new_limit)
Reject too low new limit if the current recursion depth is higher than
the new low-water mark. Otherwise it may not be possible anymore to
reset the overflowed flag to 0. */
- mark = _Py_RecursionLimitLowerWaterMark(new_limit);
- if (tstate->recursion_depth >= mark) {
+ if (tstate->recursion_depth >= new_limit) {
_PyErr_Format(tstate, PyExc_RecursionError,
"cannot set the recursion limit to %i at "
"the recursion depth %i: the limit is too low",