Mercurial > cpython-lru_cache-weakref
comparison Python/errors.c @ 53079:f221fce3d6ba
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.
........
| author | Georg Brandl <georg@python.org> |
|---|---|
| date | Sat, 11 Apr 2009 21:24:37 +0000 |
| parents | c562c8dae49a |
| children | 77cfef596d33 |
comparison
equal
deleted
inserted
replaced
| 53078:cadf955bc18b | 53079:f221fce3d6ba |
|---|---|
| 277 } | 277 } |
| 278 /* normalize recursively */ | 278 /* normalize recursively */ |
| 279 tstate = PyThreadState_GET(); | 279 tstate = PyThreadState_GET(); |
| 280 if (++tstate->recursion_depth > Py_GetRecursionLimit()) { | 280 if (++tstate->recursion_depth > Py_GetRecursionLimit()) { |
| 281 --tstate->recursion_depth; | 281 --tstate->recursion_depth; |
| 282 PyErr_SetObject(PyExc_RuntimeError, PyExc_RecursionErrorInst); | 282 /* throw away the old exception... */ |
| 283 Py_DECREF(*exc); | |
| 284 Py_DECREF(*val); | |
| 285 /* ... and use the recursion error instead */ | |
| 286 *exc = PyExc_RuntimeError; | |
| 287 *val = PyExc_RecursionErrorInst; | |
| 288 Py_INCREF(*exc); | |
| 289 Py_INCREF(*val); | |
| 290 /* just keeping the old traceback */ | |
| 283 return; | 291 return; |
| 284 } | 292 } |
| 285 PyErr_NormalizeException(exc, val, tb); | 293 PyErr_NormalizeException(exc, val, tb); |
| 286 --tstate->recursion_depth; | 294 --tstate->recursion_depth; |
| 287 } | 295 } |
