diff options
Diffstat (limited to 'Python/errors.c')
-rw-r--r-- | Python/errors.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/Python/errors.c b/Python/errors.c index d74ac34748..6a42f5912f 100644 --- a/Python/errors.c +++ b/Python/errors.c @@ -353,16 +353,13 @@ _PyErr_NormalizeException(PyThreadState *tstate, PyObject **exc, if (fixed_value == NULL) { goto error; } - Py_DECREF(value); - value = fixed_value; + Py_SETREF(value, fixed_value); } /* If the class of the instance doesn't exactly match the class of the type, believe the instance. */ else if (inclass != type) { - Py_INCREF(inclass); - Py_DECREF(type); - type = inclass; + Py_SETREF(type, Py_NewRef(inclass)); } } *exc = type; |