]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Do not release unallocated Tcl objects. Closes #117278 and #117167.
authorMartin v. Löwis <martin@v.loewis.de>
Sun, 29 Oct 2000 00:44:43 +0000 (00:44 +0000)
committerMartin v. Löwis <martin@v.loewis.de>
Sun, 29 Oct 2000 00:44:43 +0000 (00:44 +0000)
Modules/_tkinter.c

index 528b04871983ff76adcbc8404d8bafadec285ac6..86b5c220e319dc796bd1590b828b33bac2faa6bf 100644 (file)
@@ -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]);
                }
        }