Skip to content

Commit 8dbad09

Browse files
committed
pythongh-104456: Fix ref leak in test_ctypes
1 parent 46f1c78 commit 8dbad09

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Modules/_ctypes/_ctypes.c

+8
Original file line numberDiff line numberDiff line change
@@ -5487,6 +5487,14 @@ static void
54875487
comerror_dealloc(PyObject *self)
54885488
{
54895489
PyTypeObject *tp = Py_TYPE(self);
5490+
PyBaseExceptionObject *obj = (PyBaseExceptionObject *) self;
5491+
5492+
Py_CLEAR(obj->dict);
5493+
Py_CLEAR(obj->args);
5494+
Py_CLEAR(obj->notes);
5495+
Py_CLEAR(obj->traceback);
5496+
Py_CLEAR(obj->cause);
5497+
Py_CLEAR(obj->context);
54905498
PyObject_GC_UnTrack(self);
54915499
tp->tp_free(self);
54925500
Py_DECREF(tp);

0 commit comments

Comments
 (0)