summaryrefslogtreecommitdiff
path: root/Python/errors.c
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2009-04-02 18:09:04 +0000
committerGeorg Brandl <georg@python.org>2009-04-02 18:09:04 +0000
commitd3f03fa715f9f82ab512a444f8452ac5e5c87d3a (patch)
tree7adb6e88b1c29c316ede5f00ee91ca5187e54fb1 /Python/errors.c
parentdd98e04c5737554ebf6a3fe4ff0be304e8ec537a (diff)
downloadcpython-git-d3f03fa715f9f82ab512a444f8452ac5e5c87d3a.tar.gz
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.
Diffstat (limited to 'Python/errors.c')
-rw-r--r--Python/errors.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/Python/errors.c b/Python/errors.c
index 02e9572173..e0ff90f29d 100644
--- a/Python/errors.c
+++ b/Python/errors.c
@@ -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);