summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2000-10-29 00:44:43 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2000-10-29 00:44:43 (GMT)
commit02956017f978f32c17e94279744f49073b995f38 (patch)
tree4dcb338b08ba1b0ec31221cf920ca8b925375faa
parentebc37b28fa3fd66336116447b7c2b9b1c2614630 (diff)
downloadcpython-02956017f978f32c17e94279744f49073b995f38.zip
cpython-02956017f978f32c17e94279744f49073b995f38.tar.gz
cpython-02956017f978f32c17e94279744f49073b995f38.tar.bz2
Do not release unallocated Tcl objects. Closes #117278 and #117167.
-rw-r--r--Modules/_tkinter.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/Modules/_tkinter.c b/Modules/_tkinter.c
index 528b048..86b5c22 100644
--- a/Modules/_tkinter.c
+++ b/Modules/_tkinter.c
@@ -572,13 +572,13 @@ Tkapp_Call(PyObject *self, PyObject *args)
objv = objStore;
if (args == NULL)
- objc = 0;
+ /* do nothing */;
else if (!PyTuple_Check(args)) {
- objc = 1;
objv[0] = AsObj(args);
if (objv[0] == 0)
goto finally;
+ objc = 1;
Tcl_IncrRefCount(objv[0]);
}
else {
@@ -588,6 +588,7 @@ Tkapp_Call(PyObject *self, PyObject *args)
objv = (Tcl_Obj **)ckalloc(objc * sizeof(char *));
if (objv == NULL) {
PyErr_NoMemory();
+ objc = 0;
goto finally;
}
}
@@ -599,8 +600,12 @@ Tkapp_Call(PyObject *self, PyObject *args)
break;
}
objv[i] = AsObj(v);
- if (!objv[i])
+ if (!objv[i]) {
+ /* Reset objc, so it attempts to clear
+ objects only up to i. */
+ objc = i;
goto finally;
+ }
Tcl_IncrRefCount(objv[i]);
}
}