mirror of
https://github.com/python/cpython.git
synced 2025-07-19 01:05:26 +00:00
Issue #19235: Add new RecursionError exception. Patch by Georg Brandl.
This commit is contained in:
parent
27be130ec7
commit
f488fb422a
31 changed files with 101 additions and 69 deletions
|
@ -737,7 +737,7 @@ _Py_CheckRecursiveCall(const char *where)
|
|||
if (tstate->recursion_depth > recursion_limit) {
|
||||
--tstate->recursion_depth;
|
||||
tstate->overflowed = 1;
|
||||
PyErr_Format(PyExc_RuntimeError,
|
||||
PyErr_Format(PyExc_RecursionError,
|
||||
"maximum recursion depth exceeded%s",
|
||||
where);
|
||||
return -1;
|
||||
|
|
|
@ -319,7 +319,7 @@ finally:
|
|||
Py_DECREF(*exc);
|
||||
Py_DECREF(*val);
|
||||
/* ... and use the recursion error instead */
|
||||
*exc = PyExc_RuntimeError;
|
||||
*exc = PyExc_RecursionError;
|
||||
*val = PyExc_RecursionErrorInst;
|
||||
Py_INCREF(*exc);
|
||||
Py_INCREF(*val);
|
||||
|
|
|
@ -1135,7 +1135,7 @@ static int
|
|||
symtable_visit_stmt(struct symtable *st, stmt_ty s)
|
||||
{
|
||||
if (++st->recursion_depth > st->recursion_limit) {
|
||||
PyErr_SetString(PyExc_RuntimeError,
|
||||
PyErr_SetString(PyExc_RecursionError,
|
||||
"maximum recursion depth exceeded during compilation");
|
||||
VISIT_QUIT(st, 0);
|
||||
}
|
||||
|
@ -1357,7 +1357,7 @@ static int
|
|||
symtable_visit_expr(struct symtable *st, expr_ty e)
|
||||
{
|
||||
if (++st->recursion_depth > st->recursion_limit) {
|
||||
PyErr_SetString(PyExc_RuntimeError,
|
||||
PyErr_SetString(PyExc_RecursionError,
|
||||
"maximum recursion depth exceeded during compilation");
|
||||
VISIT_QUIT(st, 0);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue