Skip to content
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed reference leak in the initalization of :mod:`tkinter`.
10 changes: 9 additions & 1 deletion Modules/_tkinter.c
Original file line number Diff line number Diff line change
Expand Up @@ -3389,6 +3389,14 @@ DisableEventHook(void)
#endif
}

static void
module_free(void *mod)
{
Py_DECREF(Tkinter_TclError);
Py_DECREF(Tkapp_Type);
Py_DECREF(Tktt_Type);
Py_DECREF(PyTclObject_Type);
}

static struct PyModuleDef _tkintermodule = {
PyModuleDef_HEAD_INIT,
Expand All @@ -3399,7 +3407,7 @@ static struct PyModuleDef _tkintermodule = {
NULL,
NULL,
NULL,
NULL
module_free
};

PyMODINIT_FUNC
Expand Down