Mercurial > cpython-lru_cache-weakref
comparison Python/errors.c @ 52738:54b2cd21ab46 legacy-trunk
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 | Thu, 02 Apr 2009 18:09:04 +0000 |
| parents | 7e86fa255fc2 |
| children | d64d47ee54a1 |
comparison
equal
deleted
inserted
replaced
| 52736:c801a67ce292 | 52738:54b2cd21ab46 |
|---|---|
| 223 } | 223 } |
| 224 /* normalize recursively */ | 224 /* normalize recursively */ |
| 225 tstate = PyThreadState_GET(); | 225 tstate = PyThreadState_GET(); |
| 226 if (++tstate->recursion_depth > Py_GetRecursionLimit()) { | 226 if (++tstate->recursion_depth > Py_GetRecursionLimit()) { |
| 227 --tstate->recursion_depth; | 227 --tstate->recursion_depth; |
| 228 PyErr_SetObject(PyExc_RuntimeError, PyExc_RecursionErrorInst); | 228 /* throw away the old exception... */ |
| 229 Py_DECREF(*exc); | |
| 230 Py_DECREF(*val); | |
| 231 /* ... and use the recursion error instead */ | |
| 232 *exc = PyExc_RuntimeError; | |
| 233 *val = PyExc_RecursionErrorInst; | |
| 234 Py_INCREF(*exc); | |
| 235 Py_INCREF(*val); | |
| 236 /* just keeping the old traceback */ | |
| 229 return; | 237 return; |
| 230 } | 238 } |
| 231 PyErr_NormalizeException(exc, val, tb); | 239 PyErr_NormalizeException(exc, val, tb); |
| 232 --tstate->recursion_depth; | 240 --tstate->recursion_depth; |
| 233 } | 241 } |
