mirror of https://github.com/python/cpython
gh-123504: Fix regression in `_tkinter` initializer (#123662)
* Add module traverse function to _tkinter. * Set m_size to -1 (instead of 0).
This commit is contained in:
parent
0d6b6e34a2
commit
2daed5f7a7
|
@ -3390,7 +3390,7 @@ DisableEventHook(void)
|
|||
}
|
||||
|
||||
static int
|
||||
module_clear(PyObject *mod)
|
||||
module_clear(PyObject *Py_UNUSED(mod))
|
||||
{
|
||||
Py_CLEAR(Tkinter_TclError);
|
||||
Py_CLEAR(Tkapp_Type);
|
||||
|
@ -3399,16 +3399,28 @@ module_clear(PyObject *mod)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
module_traverse(PyObject *Py_UNUSED(module), visitproc visit, void *arg)
|
||||
{
|
||||
Py_VISIT(Tkinter_TclError);
|
||||
Py_VISIT(Tkapp_Type);
|
||||
Py_VISIT(Tktt_Type);
|
||||
Py_VISIT(PyTclObject_Type);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
module_free(void *mod)
|
||||
{
|
||||
module_clear((PyObject *)mod);
|
||||
(void)module_clear((PyObject *)mod);
|
||||
}
|
||||
|
||||
static struct PyModuleDef _tkintermodule = {
|
||||
PyModuleDef_HEAD_INIT,
|
||||
.m_name = "_tkinter",
|
||||
.m_size = -1,
|
||||
.m_methods = moduleMethods,
|
||||
.m_traverse = module_traverse,
|
||||
.m_clear = module_clear,
|
||||
.m_free = module_free
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue