Bug #1301: fixed a bad assert in _tkinter.

This commit is contained in:
Guido van Rossum 2008-01-03 23:54:04 +00:00
parent eebb79cc69
commit 076d9eef7b
2 changed files with 7 additions and 3 deletions

View File

@ -907,6 +907,8 @@ Library
Extension Modules
-----------------
- Bug #1301: Bad assert in _tkinter fixed.
- Added bdist_wininst executable for VS 2008.
- Bug #1604: collections.deque.__init__(iterable) now clears any prior contents

View File

@ -936,10 +936,12 @@ AsObj(PyObject *value)
/* This #ifdef assumes that Tcl uses UCS-2.
See TCL_UTF_MAX test above. */
#if defined(Py_UNICODE_WIDE) && TCL_UTF_MAX == 3
Tcl_UniChar *outbuf;
Tcl_UniChar *outbuf = NULL;
Py_ssize_t i;
assert(size < size * sizeof(Tcl_UniChar));
outbuf = (Tcl_UniChar*)ckalloc(size * sizeof(Tcl_UniChar));
size_t allocsize = ((size_t)size) * sizeof(Tcl_UniChar);
if (allocsize >= size)
outbuf = (Tcl_UniChar*)ckalloc(allocsize);
/* Else overflow occurred, and we take the next exit */
if (!outbuf) {
PyErr_NoMemory();
return NULL;