https://github.com/python/cpython/commit/2daed5f7a7087c63f47c57554ff55ee947e7a53d
commit: 2daed5f7a7087c63f47c57554ff55ee947e7a53d
branch: main
author: Peter Bierma <[email protected]>
committer: vstinner <[email protected]>
date: 2024-09-04T13:43:50+02:00
summary:
gh-123504: Fix regression in `_tkinter` initializer (#123662)
* Add module traverse function to _tkinter.
* Set m_size to -1 (instead of 0).
files:
M Modules/_tkinter.c
diff --git a/Modules/_tkinter.c b/Modules/_tkinter.c
index e1e81082d9ec47..4f05cab375ed6b 100644
--- a/Modules/_tkinter.c
+++ b/Modules/_tkinter.c
@@ -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
};
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]