summaryrefslogtreecommitdiffstats
path: root/Objects/exceptions.c
diff options
context:
space:
mode:
authorCollin Winter <collinw@gmail.com>2007-09-01 20:26:44 (GMT)
committerCollin Winter <collinw@gmail.com>2007-09-01 20:26:44 (GMT)
commit1966f1c98f32c482b16f1a9c1a36fc8e0628486b (patch)
tree32712f50c111e5cc456278f3ce868f36ee54f57d /Objects/exceptions.c
parent1963ad3126806672cf49ded8f524f105dcc72d33 (diff)
downloadcpython-1966f1c98f32c482b16f1a9c1a36fc8e0628486b.zip
cpython-1966f1c98f32c482b16f1a9c1a36fc8e0628486b.tar.gz
cpython-1966f1c98f32c482b16f1a9c1a36fc8e0628486b.tar.bz2
Fix refleaks exposed by test_raise.
Diffstat (limited to 'Objects/exceptions.c')
-rw-r--r--Objects/exceptions.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/Objects/exceptions.c b/Objects/exceptions.c
index cbc41e8..ce536fd 100644
--- a/Objects/exceptions.c
+++ b/Objects/exceptions.c
@@ -28,7 +28,7 @@ BaseException_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
return NULL;
/* the dict is created on the fly in PyObject_GenericSetAttr */
self->dict = NULL;
- self->traceback = NULL;
+ self->traceback = self->cause = self->context = NULL;
self->args = PyTuple_New(0);
if (!self->args) {
@@ -58,6 +58,8 @@ BaseException_clear(PyBaseExceptionObject *self)
Py_CLEAR(self->dict);
Py_CLEAR(self->args);
Py_CLEAR(self->traceback);
+ Py_CLEAR(self->cause);
+ Py_CLEAR(self->context);
return 0;
}
@@ -75,6 +77,8 @@ BaseException_traverse(PyBaseExceptionObject *self, visitproc visit, void *arg)
Py_VISIT(self->dict);
Py_VISIT(self->args);
Py_VISIT(self->traceback);
+ Py_VISIT(self->cause);
+ Py_VISIT(self->context);
return 0;
}