mirror of
https://github.com/python/cpython.git
synced 2025-09-12 11:46:52 +00:00
PyErr_NormalizeException may not set an error, so convert the PyErr_SetObject
call on hitting the recursion limit into just assigning it to the arguments provided.
This commit is contained in:
parent
dd98e04c57
commit
d3f03fa715
2 changed files with 12 additions and 1 deletions
|
@ -225,7 +225,15 @@ finally:
|
|||
tstate = PyThreadState_GET();
|
||||
if (++tstate->recursion_depth > Py_GetRecursionLimit()) {
|
||||
--tstate->recursion_depth;
|
||||
PyErr_SetObject(PyExc_RuntimeError, PyExc_RecursionErrorInst);
|
||||
/* throw away the old exception... */
|
||||
Py_DECREF(*exc);
|
||||
Py_DECREF(*val);
|
||||
/* ... and use the recursion error instead */
|
||||
*exc = PyExc_RuntimeError;
|
||||
*val = PyExc_RecursionErrorInst;
|
||||
Py_INCREF(*exc);
|
||||
Py_INCREF(*val);
|
||||
/* just keeping the old traceback */
|
||||
return;
|
||||
}
|
||||
PyErr_NormalizeException(exc, val, tb);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue