summaryrefslogtreecommitdiffstats
path: root/Modules/_tkinter.c
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/_tkinter.c')
-rw-r--r--Modules/_tkinter.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/Modules/_tkinter.c b/Modules/_tkinter.c
index 03f1453..b85e158 100644
--- a/Modules/_tkinter.c
+++ b/Modules/_tkinter.c
@@ -686,8 +686,11 @@ Tkapp_New(char *screenName, char *baseName, char *className,
ckfree(args);
}
- if (Tcl_AppInit(v->interp) != TCL_OK)
- return (TkappObject *)Tkinter_Error((PyObject *)v);
+ if (Tcl_AppInit(v->interp) != TCL_OK) {
+ PyObject *result = Tkinter_Error((PyObject *)v);
+ Py_DECREF((PyObject *)v);
+ return (TkappObject *)result;
+ }
EnableEventHook();