mirror of https://github.com/python/cpython
gh-123504: Fix reference leak in finalization of `_tkinter` (#123505)
This commit is contained in:
parent
cfbc841ef3
commit
a8bc03696c
|
@ -0,0 +1 @@
|
|||
Fixed reference leak in the finalization of :mod:`tkinter`.
|
|
@ -3389,17 +3389,28 @@ DisableEventHook(void)
|
|||
#endif
|
||||
}
|
||||
|
||||
static int
|
||||
module_clear(PyObject *mod)
|
||||
{
|
||||
Py_CLEAR(Tkinter_TclError);
|
||||
Py_CLEAR(Tkapp_Type);
|
||||
Py_CLEAR(Tktt_Type);
|
||||
Py_CLEAR(PyTclObject_Type);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
module_free(void *mod)
|
||||
{
|
||||
module_clear((PyObject *)mod);
|
||||
}
|
||||
|
||||
static struct PyModuleDef _tkintermodule = {
|
||||
PyModuleDef_HEAD_INIT,
|
||||
"_tkinter",
|
||||
NULL,
|
||||
-1,
|
||||
moduleMethods,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
.m_name = "_tkinter",
|
||||
.m_methods = moduleMethods,
|
||||
.m_clear = module_clear,
|
||||
.m_free = module_free
|
||||
};
|
||||
|
||||
PyMODINIT_FUNC
|
||||
|
|
Loading…
Reference in New Issue