Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bbe6306

Browse files
committed
Merged revisions 78189 via svnmerge from
svn+ssh://[email protected]/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. ........
1 parent 66f575b commit bbe6306

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

Include/pymem.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,10 @@ PyAPI_FUNC(void) PyMem_Free(void *);
9090
*/
9191

9292
#define PyMem_New(type, n) \
93-
( ((n) > PY_SSIZE_T_MAX / sizeof(type)) ? NULL : \
93+
( ((size_t)(n) > PY_SSIZE_T_MAX / sizeof(type)) ? NULL : \
9494
( (type *) PyMem_Malloc((n) * sizeof(type)) ) )
9595
#define PyMem_NEW(type, n) \
96-
( ((n) > PY_SSIZE_T_MAX / sizeof(type)) ? NULL : \
96+
( ((size_t)(n) > PY_SSIZE_T_MAX / sizeof(type)) ? NULL : \
9797
( (type *) PyMem_MALLOC((n) * sizeof(type)) ) )
9898

9999
/*
@@ -103,10 +103,10 @@ PyAPI_FUNC(void) PyMem_Free(void *);
103103
* caller's memory error handler to not lose track of it.
104104
*/
105105
#define PyMem_Resize(p, type, n) \
106-
( (p) = ((n) > PY_SSIZE_T_MAX / sizeof(type)) ? NULL : \
106+
( (p) = ((size_t)(n) > PY_SSIZE_T_MAX / sizeof(type)) ? NULL : \
107107
(type *) PyMem_Realloc((p), (n) * sizeof(type)) )
108108
#define PyMem_RESIZE(p, type, n) \
109-
( (p) = ((n) > PY_SSIZE_T_MAX / sizeof(type)) ? NULL : \
109+
( (p) = ((size_t)(n) > PY_SSIZE_T_MAX / sizeof(type)) ? NULL : \
110110
(type *) PyMem_REALLOC((p), (n) * sizeof(type)) )
111111

112112
/* PyMem{Del,DEL} are left over from ancient days, and shouldn't be used

Modules/arraymodule.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2211,14 +2211,14 @@ array_ass_subscr(arrayobject* self, PyObject* item, PyObject* value)
22112211
cur += step, i++) {
22122212
Py_ssize_t lim = step - 1;
22132213

2214-
if (cur + step >= Py_SIZE(self))
2214+
if (cur + step >= (size_t)Py_SIZE(self))
22152215
lim = Py_SIZE(self) - cur - 1;
22162216
memmove(self->ob_item + (cur - i) * itemsize,
22172217
self->ob_item + (cur + 1) * itemsize,
22182218
lim * itemsize);
22192219
}
22202220
cur = start + slicelength * step;
2221-
if (cur < Py_SIZE(self)) {
2221+
if (cur < (size_t)Py_SIZE(self)) {
22222222
memmove(self->ob_item + (cur-slicelength) * itemsize,
22232223
self->ob_item + cur * itemsize,
22242224
(Py_SIZE(self) - cur) * itemsize);

0 commit comments

Comments
 (0)