Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion Modules/_ctypes/_ctypes.c
Original file line number Diff line number Diff line change
Expand Up @@ -5476,10 +5476,24 @@ comerror_init(PyObject *self, PyObject *args, PyObject *kwds)
return 0;
}

static int
comerror_clear(PyObject *self) {
Comment thread
erlend-aasland marked this conversation as resolved.
Outdated
PyBaseExceptionObject *obj = (PyBaseExceptionObject *) self;
Py_CLEAR(obj->dict);
Py_CLEAR(obj->args);
Py_CLEAR(obj->notes);
Py_CLEAR(obj->traceback);
Py_CLEAR(obj->cause);
Py_CLEAR(obj->context);
return 0;
Comment thread
sunmy2019 marked this conversation as resolved.
Outdated
}

static int
comerror_traverse(PyObject *self, visitproc visit, void *arg)
{
Py_VISIT(Py_TYPE(self));
PyTypeObject *tp = Py_TYPE(self);
Py_VISIT(tp);
tp->tp_clear(self);
Comment thread
sunmy2019 marked this conversation as resolved.
Outdated
return 0;
}

Expand All @@ -5488,6 +5502,7 @@ comerror_dealloc(PyObject *self)
{
PyTypeObject *tp = Py_TYPE(self);
PyObject_GC_UnTrack(self);
tp->tp_clear(self);
Comment thread
Eclips4 marked this conversation as resolved.
Outdated
tp->tp_free(self);
Py_DECREF(tp);
}
Expand All @@ -5497,6 +5512,7 @@ static PyType_Slot comerror_slots[] = {
{Py_tp_init, comerror_init},
{Py_tp_traverse, comerror_traverse},
{Py_tp_dealloc, comerror_dealloc},
{Py_tp_clear, comerror_clear},
{0, NULL},
};

Expand Down