summaryrefslogtreecommitdiff
path: root/Objects/exceptions.c
diff options
context:
space:
mode:
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 cbc41e8ba2..ce536fd78d 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;
}