Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

gh-104456: Fix ref leak in _ctypes.COMError #104457

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
May 14, 2023
Merged
Changes from all 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
10 changes: 9 additions & 1 deletion 10 Modules/_ctypes/_ctypes.c
Original file line number Diff line number Diff line change
Expand Up @@ -5476,18 +5476,25 @@ comerror_init(PyObject *self, PyObject *args, PyObject *kwds)
return 0;
}

static int
comerror_clear(PyObject *self)
{
return ((PyTypeObject *)PyExc_BaseException)->tp_clear(self);
Eclips4 marked this conversation as resolved.
Show resolved Hide resolved
}

static int
comerror_traverse(PyObject *self, visitproc visit, void *arg)
{
Py_VISIT(Py_TYPE(self));
return 0;
return ((PyTypeObject *)PyExc_BaseException)->tp_traverse(self, visit, arg);
}

static void
comerror_dealloc(PyObject *self)
{
PyTypeObject *tp = Py_TYPE(self);
PyObject_GC_UnTrack(self);
(void)comerror_clear(self);
Eclips4 marked this conversation as resolved.
Show resolved Hide resolved
tp->tp_free(self);
Py_DECREF(tp);
}
Expand All @@ -5497,6 +5504,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
Morty Proxy This is a proxified and sanitized view of the page, visit original site.