diff options
| author | Collin Winter <collinw@gmail.com> | 2007-09-01 20:26:44 +0000 |
|---|---|---|
| committer | Collin Winter <collinw@gmail.com> | 2007-09-01 20:26:44 +0000 |
| commit | 049928dc441bf3004b5cca014e8bfd167d14cd72 (patch) | |
| tree | 4c55f67790a06db9e6b9b991925c42675a6935b3 /Python | |
| parent | 1729a0ee83458ef773553afa5a4f34190a46cbc6 (diff) | |
| download | cpython-049928dc441bf3004b5cca014e8bfd167d14cd72.tar.gz | |
Fix refleaks exposed by test_raise.
Diffstat (limited to 'Python')
| -rw-r--r-- | Python/ceval.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Python/ceval.c b/Python/ceval.c index 24d4dec277..fa08fe6840 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -2967,7 +2967,6 @@ do_raise(PyObject *exc, PyObject *cause) /* 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 @@ do_raise(PyObject *exc, PyObject *cause) 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 @@ raise_error: Py_XDECREF(value); Py_XDECREF(type); Py_XDECREF(tb); + Py_XDECREF(cause); return WHY_EXCEPTION; } |
