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

Serhiy Storchaka webhook-mailer at python.org
Sun Oct 28 13:36:05 EDT 2018


https://github.com/python/cpython/commit/aaea2802da0a074c695ab86911d8bcc0b2dd5ec5
commit: aaea2802da0a074c695ab86911d8bcc0b2dd5ec5
branch: 2.7
author: Serhiy Storchaka <storchaka at gmail.com>
committer: GitHub <noreply at github.com>
date: 2018-10-28T19:36:02+02:00
summary:

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

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

files:
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
+Tcl/Tk.
diff --git a/Modules/_tkinter.c b/Modules/_tkinter.c
index c71ffd016ad8..58640e240f37 100644
--- a/Modules/_tkinter.c
+++ b/Modules/_tkinter.c
@@ -1205,10 +1205,8 @@ AsObj(PyObject *value)
     }
 #endif
 
-    if(PyTclObject_Check(value)) {
-        Tcl_Obj *v = ((PyTclObject*)value)->value;
-        Tcl_IncrRefCount(v);
-        return v;
+    if (PyTclObject_Check(value)) {
+        return ((PyTclObject*)value)->value;
     }
 
     {



More information about the Python-checkins mailing list