Skip to content

Commit

Permalink
gh-104456: Fix ref leak in test_ctypes
Browse files Browse the repository at this point in the history
  • Loading branch information
Eclips4 committed May 13, 2023
1 parent 46f1c78 commit 8dbad09
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Modules/_ctypes/_ctypes.c
Original file line number Diff line number Diff line change
Expand Up @@ -5487,6 +5487,14 @@ 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_free(self);
Py_DECREF(tp);
Expand Down

0 comments on commit 8dbad09

Please sign in to comment.