-
-
Notifications
You must be signed in to change notification settings - Fork 34.5k
gh-123504: Fix reference leak in initialization of _tkinter
#123505
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
Changes from 3 commits
cddd021
a9eb482
36c65af
cc291e4
df9265f
4f1f4e4
a77abba
f35f2a0
fc34562
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Fixed reference leak in the initalization of :mod:`tkinter`. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3421,6 +3421,7 @@ PyInit__tkinter(void) | |
| Tkinter_TclError = PyErr_NewException("_tkinter.TclError", NULL, NULL); | ||
| if (PyModule_AddObjectRef(m, "TclError", Tkinter_TclError)) { | ||
| Py_DECREF(m); | ||
| Py_DECREF(Tkinter_TclError); | ||
| return NULL; | ||
| } | ||
|
|
||
|
|
@@ -3474,18 +3475,21 @@ PyInit__tkinter(void) | |
| Py_DECREF(m); | ||
| return NULL; | ||
| } | ||
| Py_DECREF(Tkapp_Type); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is the same for all other global references (otherwise why would they be global references?). Yes, if you want to release these references, you need a module clearing function. This is not a big deal, because usually when you unload the module, you quit the program, so who cares about few dangling references? |
||
|
|
||
| Tktt_Type = PyType_FromSpec(&Tktt_Type_spec); | ||
| if (PyModule_AddObjectRef(m, "TkttType", Tktt_Type)) { | ||
| Py_DECREF(m); | ||
| return NULL; | ||
| } | ||
| Py_DECREF(Tktt_Type); | ||
|
|
||
| PyTclObject_Type = PyType_FromSpec(&PyTclObject_Type_spec); | ||
| if (PyModule_AddObjectRef(m, "Tcl_Obj", PyTclObject_Type)) { | ||
| Py_DECREF(m); | ||
| return NULL; | ||
| } | ||
| Py_DECREF(PyTclObject_Type); | ||
|
|
||
|
|
||
| /* This helps the dynamic loader; in Unicode aware Tcl versions | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.