[Python-checkins] bpo-34794: Fix a leak in Tkinter. (GH-10025)

Miss Islington (bot) webhook-mailer at python.org
Tue Oct 23 16:25:56 EDT 2018

commit: 2c549250d8fd6755e3338a771d250e34c78bdb50
branch: 3.6
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: GitHub <noreply at github.com>
date: 2018-10-23T13:25:53-07:00

bpo-34794: Fix a leak in Tkinter. (GH-10025)

Based on the investigation by Xiang Zhang.
(cherry picked from commit df13df41a25765d8a39a77220691698498e758d4)

Co-authored-by: Serhiy Storchaka <storchaka at gmail.com>

A Misc/NEWS.d/next/Library/2018-10-21-14-53-19.bpo-34794.yt3R4-.rst
M Modules/_tkinter.c

diff --git a/Misc/NEWS.d/next/Library/2018-10-21-14-53-19.bpo-34794.yt3R4-.rst b/Misc/NEWS.d/next/Library/2018-10-21-14-53-19.bpo-34794.yt3R4-.rst
new file mode 100644
index 000000000000..770807fc7653
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2018-10-21-14-53-19.bpo-34794.yt3R4-.rst
@@ -0,0 +1,2 @@
+Fixed a leak in Tkinter when pass the Python wrapper around Tcl_Obj back to
diff --git a/Modules/_tkinter.c b/Modules/_tkinter.c
index 68ee26e790cc..080b44f78562 100644
--- a/Modules/_tkinter.c
+++ b/Modules/_tkinter.c
@@ -1153,9 +1153,7 @@ AsObj(PyObject *value)
     if (PyTclObject_Check(value)) {
-        Tcl_Obj *v = ((PyTclObject*)value)->value;
-        Tcl_IncrRefCount(v);
-        return v;
+        return ((PyTclObject*)value)->value;

More information about the Python-checkins mailing list