summaryrefslogtreecommitdiffstats
path: root/Python/sysmodule.c
diff options
context:
space:
mode:
authorGregory P. Smith <greg@krypto.org>2021-04-04 11:02:29 (GMT)
committerGitHub <noreply@github.com>2021-04-04 11:02:29 (GMT)
commitc7b0feca25fc68ec3e0884b82e5f45a4da011e8e (patch)
tree0dff16d035648b7c31fb291d40430407484579c6 /Python/sysmodule.c
parentde0b2b133011953b02536cc78f2499d5d55224f8 (diff)
downloadcpython-c7b0feca25fc68ec3e0884b82e5f45a4da011e8e.zip
cpython-c7b0feca25fc68ec3e0884b82e5f45a4da011e8e.tar.gz
cpython-c7b0feca25fc68ec3e0884b82e5f45a4da011e8e.tar.bz2
[3.9] bpo-43710: Rollback the 3.9 bpo-42500 fix, it broke the ABI in 3.9.3 (#25179)
This reverts commit 8b795ab5541d8a4e69be4137dfdc207714270b77. It changed the PyThreadState structure size, breaking the ABI in 3.9.3.
Diffstat (limited to 'Python/sysmodule.c')
-rw-r--r--Python/sysmodule.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Python/sysmodule.c b/Python/sysmodule.c
index 4c7f7b6..3e4115f 100644
--- a/Python/sysmodule.c
+++ b/Python/sysmodule.c
@@ -1160,6 +1160,7 @@ 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) {
@@ -1177,7 +1178,8 @@ 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. */
- if (tstate->recursion_depth >= new_limit) {
+ mark = _Py_RecursionLimitLowerWaterMark(new_limit);
+ if (tstate->recursion_depth >= mark) {
_PyErr_Format(tstate, PyExc_RecursionError,
"cannot set the recursion limit to %i at "
"the recursion depth %i: the limit is too low",