Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Add suggestion
  • Loading branch information
Eclips4 committed May 13, 2023
commit 28ac7ed44275d48fad021e55ff10d44906de4531
26 changes: 17 additions & 9 deletions Modules/_ctypes/_ctypes.c
Original file line number Diff line number Diff line change
Expand Up @@ -5476,26 +5476,33 @@ 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;
}

static void
comerror_dealloc(PyObject *self)
{
PyTypeObject *tp = Py_TYPE(self);
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);
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 @@ -5505,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