mirror of
https://github.com/python/cpython.git
synced 2025-10-10 00:43:41 +00:00
bpo-42500: Fix recursion in or after except (GH-23568) (#24501)
* Use counter, rather boolean state when handling soft overflows.
(cherry picked from commit 4e7a69bdb6
)
This commit is contained in:
parent
f836e5f219
commit
8b795ab554
9 changed files with 76 additions and 75 deletions
|
@ -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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue