[Python-checkins] r46875 - python/trunk/Modules/_tkinter.c python/trunk/Modules/bz2module.c python/trunk/Modules/dlmodule.c
neal.norwitz
python-checkins at python.org
Mon Jun 12 04:06:43 CEST 2006
Author: neal.norwitz
Date: Mon Jun 12 04:06:42 2006
New Revision: 46875
Modified:
python/trunk/Modules/_tkinter.c
python/trunk/Modules/bz2module.c
python/trunk/Modules/dlmodule.c
Log:
Fix some Py_ssize_t issues
Modified: python/trunk/Modules/_tkinter.c
==============================================================================
--- python/trunk/Modules/_tkinter.c (original)
+++ python/trunk/Modules/_tkinter.c Mon Jun 12 04:06:42 2006
@@ -932,12 +932,13 @@
#ifdef Py_USING_UNICODE
else if (PyUnicode_Check(value)) {
Py_UNICODE *inbuf = PyUnicode_AS_UNICODE(value);
- int size = PyUnicode_GET_SIZE(value);
+ Py_ssize_t size = PyUnicode_GET_SIZE(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;
- int i;
+ Py_ssize_t i;
+ assert(size < size * sizeof(Tcl_UniChar));
outbuf = (Tcl_UniChar*)ckalloc(size * sizeof(Tcl_UniChar));
if (!outbuf) {
PyErr_NoMemory();
Modified: python/trunk/Modules/bz2module.c
==============================================================================
--- python/trunk/Modules/bz2module.c (original)
+++ python/trunk/Modules/bz2module.c Mon Jun 12 04:06:42 2006
@@ -1570,7 +1570,7 @@
}
}
- _PyString_Resize(&ret, (int)(BZS_TOTAL_OUT(bzs) - totalout));
+ _PyString_Resize(&ret, (Py_ssize_t)(BZS_TOTAL_OUT(bzs) - totalout));
RELEASE_LOCK(self);
return ret;
@@ -1636,7 +1636,7 @@
}
if (bzs->avail_out != 0)
- _PyString_Resize(&ret, (int)(BZS_TOTAL_OUT(bzs) - totalout));
+ _PyString_Resize(&ret, (Py_ssize_t)(BZS_TOTAL_OUT(bzs) - totalout));
RELEASE_LOCK(self);
return ret;
@@ -1860,7 +1860,7 @@
}
if (bzs->avail_out != 0)
- _PyString_Resize(&ret, (int)(BZS_TOTAL_OUT(bzs) - totalout));
+ _PyString_Resize(&ret, (Py_ssize_t)(BZS_TOTAL_OUT(bzs) - totalout));
RELEASE_LOCK(self);
return ret;
@@ -2069,7 +2069,7 @@
}
if (bzs->avail_out != 0)
- _PyString_Resize(&ret, (int)BZS_TOTAL_OUT(bzs));
+ _PyString_Resize(&ret, (Py_ssize_t)BZS_TOTAL_OUT(bzs));
BZ2_bzCompressEnd(bzs);
return ret;
@@ -2148,7 +2148,7 @@
}
if (bzs->avail_out != 0)
- _PyString_Resize(&ret, (int)BZS_TOTAL_OUT(bzs));
+ _PyString_Resize(&ret, (Py_ssize_t)BZS_TOTAL_OUT(bzs));
BZ2_bzDecompressEnd(bzs);
return ret;
Modified: python/trunk/Modules/dlmodule.c
==============================================================================
--- python/trunk/Modules/dlmodule.c (original)
+++ python/trunk/Modules/dlmodule.c Mon Jun 12 04:06:42 2006
@@ -77,8 +77,8 @@
long, long, long, long, long);
long alist[10];
long res;
- int i;
- int n = PyTuple_Size(args);
+ Py_ssize_t i;
+ Py_ssize_t n = PyTuple_Size(args);
if (n < 1) {
PyErr_SetString(PyExc_TypeError, "at least a name is needed");
return NULL;
More information about the Python-checkins
mailing list