[Python-checkins] r78192 - in python/branches/py3k: Include/pymem.h Modules/arraymodule.c

mark.dickinson python-checkins at python.org
Sun Feb 14 15:08:55 CET 2010


Author: mark.dickinson
Date: Sun Feb 14 15:08:54 2010
New Revision: 78192

Log:
Merged revisions 78189 via svnmerge from 
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r78189 | mark.dickinson | 2010-02-14 13:40:30 +0000 (Sun, 14 Feb 2010) | 1 line
  
  Silence more 'comparison between signed and unsigned' warnings.
........


Modified:
   python/branches/py3k/   (props changed)
   python/branches/py3k/Include/pymem.h
   python/branches/py3k/Modules/arraymodule.c

Modified: python/branches/py3k/Include/pymem.h
==============================================================================
--- python/branches/py3k/Include/pymem.h	(original)
+++ python/branches/py3k/Include/pymem.h	Sun Feb 14 15:08:54 2010
@@ -90,10 +90,10 @@
  */
 
 #define PyMem_New(type, n) \
-  ( ((n) > PY_SSIZE_T_MAX / sizeof(type)) ? NULL : \
+  ( ((size_t)(n) > PY_SSIZE_T_MAX / sizeof(type)) ? NULL :	\
 	( (type *) PyMem_Malloc((n) * sizeof(type)) ) )
 #define PyMem_NEW(type, n) \
-  ( ((n) > PY_SSIZE_T_MAX / sizeof(type)) ? NULL : \
+  ( ((size_t)(n) > PY_SSIZE_T_MAX / sizeof(type)) ? NULL :	\
 	( (type *) PyMem_MALLOC((n) * sizeof(type)) ) )
 
 /*
@@ -103,10 +103,10 @@
  * caller's memory error handler to not lose track of it.
  */
 #define PyMem_Resize(p, type, n) \
-  ( (p) = ((n) > PY_SSIZE_T_MAX / sizeof(type)) ? NULL : \
+  ( (p) = ((size_t)(n) > PY_SSIZE_T_MAX / sizeof(type)) ? NULL :	\
 	(type *) PyMem_Realloc((p), (n) * sizeof(type)) )
 #define PyMem_RESIZE(p, type, n) \
-  ( (p) = ((n) > PY_SSIZE_T_MAX / sizeof(type)) ? NULL : \
+  ( (p) = ((size_t)(n) > PY_SSIZE_T_MAX / sizeof(type)) ? NULL :	\
 	(type *) PyMem_REALLOC((p), (n) * sizeof(type)) )
 
 /* PyMem{Del,DEL} are left over from ancient days, and shouldn't be used

Modified: python/branches/py3k/Modules/arraymodule.c
==============================================================================
--- python/branches/py3k/Modules/arraymodule.c	(original)
+++ python/branches/py3k/Modules/arraymodule.c	Sun Feb 14 15:08:54 2010
@@ -2211,14 +2211,14 @@
 		     cur += step, i++) {
 			Py_ssize_t lim = step - 1;
 
-			if (cur + step >= Py_SIZE(self))
+			if (cur + step >= (size_t)Py_SIZE(self))
 				lim = Py_SIZE(self) - cur - 1;
 			memmove(self->ob_item + (cur - i) * itemsize,
 				self->ob_item + (cur + 1) * itemsize,
 				lim * itemsize);
 		}
 		cur = start + slicelength * step;
-		if (cur < Py_SIZE(self)) {
+		if (cur < (size_t)Py_SIZE(self)) {
 			memmove(self->ob_item + (cur-slicelength) * itemsize,
 				self->ob_item + cur * itemsize,
 				(Py_SIZE(self) - cur) * itemsize);


More information about the Python-checkins mailing list