Mercurial > cpython-lru_cache-weakref
diff Python/ceval.c @ 43188:386c22d93ab6
Fix refleaks exposed by test_raise.
| author | Collin Winter <collinw@gmail.com> |
|---|---|
| date | Sat, 01 Sep 2007 20:26:44 +0000 |
| parents | 981ecc526703 |
| children | b06b191b7cfa |
line wrap: on
line diff
--- a/Python/ceval.c Sat Sep 01 19:47:39 2007 +0000 +++ b/Python/ceval.c Sat Sep 01 20:26:44 2007 +0000 @@ -2967,7 +2967,6 @@ /* Not something you can raise. You get an exception anyway, just not what you specified :-) */ Py_DECREF(exc); - Py_XDECREF(cause); PyErr_SetString(PyExc_TypeError, "exceptions must derive from BaseException"); goto raise_error; @@ -2980,12 +2979,12 @@ fixed_cause = PyObject_CallObject(cause, NULL); if (fixed_cause == NULL) goto raise_error; + Py_DECREF(cause); } else if (PyExceptionInstance_Check(cause)) { fixed_cause = cause; } else { - Py_DECREF(cause); PyErr_SetString(PyExc_TypeError, "exception causes must derive from BaseException"); goto raise_error; @@ -3000,6 +2999,7 @@ Py_XDECREF(value); Py_XDECREF(type); Py_XDECREF(tb); + Py_XDECREF(cause); return WHY_EXCEPTION; }
