From 4abc9047b9f6dc75590b2cb7b29fa3e963ed5d81 Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Sun, 21 Oct 2018 14:54:17 +0300 Subject: [PATCH] bpo-34794: Fix a leak in Tkinter. --- .../next/Library/2018-10-21-14-53-19.bpo-34794.yt3R4-.rst | 2 ++ Modules/_tkinter.c | 4 +--- 2 files changed, 3 insertions(+), 3 deletions(-) create mode 100644 Misc/NEWS.d/next/Library/2018-10-21-14-53-19.bpo-34794.yt3R4-.rst 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 00000000000000..770807fc765365 --- /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 93d4dbc5f659a0..fa268599876a2c 100644 --- a/Modules/_tkinter.c +++ b/Modules/_tkinter.c @@ -1101,9 +1101,7 @@ AsObj(PyObject *value) } if (PyTclObject_Check(value)) { - Tcl_Obj *v = ((PyTclObject*)value)->value; - Tcl_IncrRefCount(v); - return v; + return ((PyTclObject*)value)->value; } {