diff options
author | Georg Brandl <georg@python.org> | 2009-04-11 21:24:37 +0000 |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2009-04-11 21:24:37 +0000 |
commit | 9d873153104a7b482449ada9a2fd844524853daf (patch) | |
tree | 6bb3865e9c0b0c656c76ea23252ff4357e59ef84 /Python/errors.c | |
parent | ed513ef79724535c9ad2488e664ae17dc4d80dec (diff) | |
download | cpython-9d873153104a7b482449ada9a2fd844524853daf.tar.gz |
Merged revisions 71024,71058 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r71024 | georg.brandl | 2009-04-02 04:47:44 +0200 (Do, 02 Apr 2009) | 4 lines
In PyErr_GivenExceptionMatches, temporarily bump the recursion
limit, so that in the most common case PyObject_IsSubclass will
not raise a recursion error we have to ignore anyway.
........
r71058 | georg.brandl | 2009-04-02 20:09:04 +0200 (Do, 02 Apr 2009) | 3 lines
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.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/Python/errors.c b/Python/errors.c index 63353881b0..cccc0f7778 100644 --- a/Python/errors.c +++ b/Python/errors.c @@ -279,7 +279,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); |