diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2015-12-27 15:41:34 +0200 |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2015-12-27 15:41:34 +0200 |
commit | 38f3c4611a7ed03dddc07fbd568b619af8b139a4 (patch) | |
tree | 6c7f540b5269ad3335a325f812fdc7793408827d /Python/errors.c | |
parent | 49b4fe42c04e1eec009aac77da7f44d985b1abbb (diff) | |
download | cpython-38f3c4611a7ed03dddc07fbd568b619af8b139a4.tar.gz |
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.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/Python/errors.c b/Python/errors.c index aed2bdc12d..7b67566727 100644 --- a/Python/errors.c +++ b/Python/errors.c @@ -315,14 +315,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_RecursionError; - *val = PyExc_RecursionErrorInst; - Py_INCREF(*exc); - Py_INCREF(*val); + /* throw away the old exception and use the recursion error instead */ + Py_INCREF(PyExc_RecursionError); + Py_SETREF(*exc, PyExc_RecursionError); + Py_INCREF(PyExc_RecursionErrorInst); + Py_SETREF(*val, PyExc_RecursionErrorInst); /* just keeping the old traceback */ return; } |