diff options
author | Mark Shannon <mark@hotpy.org> | 2020-12-02 13:30:55 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-02 13:30:55 (GMT) |
commit | 4e7a69bdb63a104587759d7784124492dcdd496e (patch) | |
tree | 5477c7077970d9100d089286b75ce2ff408ac613 /Python/errors.c | |
parent | 93a0ef76473683aa3ad215e11df18f7839488c4e (diff) | |
download | cpython-4e7a69bdb63a104587759d7784124492dcdd496e.zip cpython-4e7a69bdb63a104587759d7784124492dcdd496e.tar.gz cpython-4e7a69bdb63a104587759d7784124492dcdd496e.tar.bz2 |
bpo-42500: Fix recursion in or after except (GH-23568)
* Use counter, rather boolean state when handling soft overflows.
Diffstat (limited to 'Python/errors.c')
-rw-r--r-- | Python/errors.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Python/errors.c b/Python/errors.c index f80ae21..8242ac6 100644 --- a/Python/errors.c +++ b/Python/errors.c @@ -290,12 +290,14 @@ _PyErr_NormalizeException(PyThreadState *tstate, PyObject **exc, PyObject **val, PyObject **tb) { int recursion_depth = 0; + tstate->recursion_headroom++; PyObject *type, *value, *initial_tb; restart: type = *exc; if (type == NULL) { /* There was no exception, so nothing to do. */ + tstate->recursion_headroom--; return; } @@ -347,6 +349,7 @@ _PyErr_NormalizeException(PyThreadState *tstate, PyObject **exc, } *exc = type; *val = value; + tstate->recursion_headroom--; return; error: |