Serhiy Storchaka added the comment:
> * Tkapp_CallDeallocArgs() ckfree() on memory allocated by PyMem_Malloc() =>
> wrong
Oh, you are right, thanks.
> (see my review on Rietveld).
Perhaps you forgot to press the "Publish" button.
----------
Added file: http://bugs.python.org/file36599/tkinter_pymem_3.patch
_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue22336>
_______________________________________
diff -r 180f5bf7d1b9 Modules/_tkinter.c
--- a/Modules/_tkinter.c Thu Sep 11 14:33:02 2014 +0300
+++ b/Modules/_tkinter.c Thu Sep 11 15:49:49 2014 +0300
@@ -605,7 +605,7 @@
Tcl_SetVar(v->interp, "tcl_interactive", "0", TCL_GLOBAL_ONLY);
/* This is used to get the application class for Tk 4.1 and up */
- argv0 = (char*)attemptckalloc(strlen(className) + 1);
+ argv0 = (char*)PyMem_Malloc(strlen(className) + 1);
if (!argv0) {
PyErr_NoMemory();
Py_DECREF(v);
@@ -616,7 +616,7 @@
if (Py_ISUPPER(Py_CHARMASK(argv0[0])))
argv0[0] = Py_TOLOWER(Py_CHARMASK(argv0[0]));
Tcl_SetVar(v->interp, "argv0", argv0, TCL_GLOBAL_ONLY);
- ckfree(argv0);
+ PyMem_Free(argv0);
if (! wantTk) {
Tcl_SetVar(v->interp,
@@ -639,7 +639,7 @@
if (use)
len += strlen(use) + sizeof "-use ";
- args = (char*)attemptckalloc(len);
+ args = (char*)PyMem_Malloc(len);
if (!args) {
PyErr_NoMemory();
Py_DECREF(v);
@@ -657,7 +657,7 @@
}
Tcl_SetVar(v->interp, "argv", args, TCL_GLOBAL_ONLY);
- ckfree(args);
+ PyMem_Free(args);
}
if (Tcl_AppInit(v->interp) != TCL_OK) {
@@ -914,15 +914,15 @@
"list is too long");
return NULL;
}
- argv = (Tcl_Obj **) attemptckalloc(((size_t)size) * sizeof(Tcl_Obj *));
- if(!argv) {
+ argv = (Tcl_Obj **) PyMem_Malloc(((size_t)size) * sizeof(Tcl_Obj *));
+ if (!argv) {
PyErr_NoMemory();
return NULL;
}
for (i = 0; i < size; i++)
argv[i] = AsObj(PySequence_Fast_GET_ITEM(value,i));
result = Tcl_NewListObj(size, argv);
- ckfree(FREECAST argv);
+ PyMem_Free(argv);
return result;
}
else if (PyUnicode_Check(value)) {
@@ -948,7 +948,7 @@
if (kind == sizeof(Tcl_UniChar))
return Tcl_NewUnicodeObj(inbuf, size);
allocsize = ((size_t)size) * sizeof(Tcl_UniChar);
- outbuf = (Tcl_UniChar*)attemptckalloc(allocsize);
+ outbuf = (Tcl_UniChar*)PyMem_Malloc(allocsize);
/* Else overflow occurred, and we take the next exit */
if (!outbuf) {
PyErr_NoMemory();
@@ -965,14 +965,14 @@
"character U+%x is above the range "
"(U+0000-U+FFFF) allowed by Tcl",
ch);
- ckfree(FREECAST outbuf);
+ PyMem_Free(outbuf);
return NULL;
}
#endif
outbuf[i] = ch;
}
result = Tcl_NewUnicodeObj(outbuf, size);
- ckfree(FREECAST outbuf);
+ PyMem_Free(outbuf);
return result;
}
else if(PyTclObject_Check(value)) {
@@ -1084,7 +1084,7 @@
for (i = 0; i < objc; i++)
Tcl_DecrRefCount(objv[i]);
if (objv != objStore)
- ckfree(FREECAST objv);
+ PyMem_Free(objv);
}
/* Convert Python objects to Tcl objects. This must happen in the
@@ -1115,7 +1115,7 @@
"list is too long");
return NULL;
}
- objv = (Tcl_Obj **)attemptckalloc(((size_t)objc) * sizeof(Tcl_Obj
*));
+ objv = (Tcl_Obj **)PyMem_Malloc(((size_t)objc) * sizeof(Tcl_Obj
*));
if (objv == NULL) {
PyErr_NoMemory();
objc = 0;
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com