summaryrefslogtreecommitdiffstats
path: root/Python/errors.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2015-12-27 13:41:58 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2015-12-27 13:41:58 (GMT)
commit2e6c8296817a8476cdb4c3c6ce6d79304379a4d7 (patch)
treeb72997107e4fafd6aa8fdfef95dfe2c3d7b2d035 /Python/errors.c
parent8688acaf2ef4f355725bf4d5bf024fed99752061 (diff)
downloadcpython-2e6c8296817a8476cdb4c3c6ce6d79304379a4d7.zip
cpython-2e6c8296817a8476cdb4c3c6ce6d79304379a4d7.tar.gz
cpython-2e6c8296817a8476cdb4c3c6ce6d79304379a4d7.tar.bz2
Issue #20440: More use of Py_SETREF.
This patch is manually crafted and contains changes that couldn't be handled automatically.
Diffstat (limited to 'Python/errors.c')
-rw-r--r--Python/errors.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/Python/errors.c b/Python/errors.c
index 00dfd3e..5cbf5c9 100644
--- a/Python/errors.c
+++ b/Python/errors.c
@@ -227,14 +227,11 @@ finally:
tstate = PyThreadState_GET();
if (++tstate->recursion_depth > Py_GetRecursionLimit()) {
--tstate->recursion_depth;
- /* 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);
+ /* throw away the old exception and use the recursion error instead */
+ Py_INCREF(PyExc_RuntimeError);
+ Py_SETREF(*exc, PyExc_RuntimeError);
+ Py_INCREF(PyExc_RecursionErrorInst);
+ Py_SETREF(*val, PyExc_RecursionErrorInst);
/* just keeping the old traceback */
return;
}