Mercurial > cpython-lru_cache-weakref
diff Modules/arraymodule.c @ 13942:31b25ac1f019 legacy-trunk
Use safer comparisons (only matters when sizeof(int) != sizeof(size_t)). fread
and fwrite return size_t, so it is safer to cast up to the largest type for the
comparison. I believe the cast is required at all to remove compiler warnings.
| author | Trent Mick <trentm@activestate.com> |
|---|---|
| date | Sat, 12 Aug 2000 20:58:11 +0000 |
| parents | 136d3d72666a |
| children | 984abd20eec2 |
line wrap: on
line diff
--- a/Modules/arraymodule.c Sat Aug 12 20:32:46 2000 +0000 +++ b/Modules/arraymodule.c Sat Aug 12 20:58:11 2000 +0000 @@ -1039,8 +1039,8 @@ return NULL; } if (self->ob_size > 0) { - if ((int)fwrite(self->ob_item, self->ob_descr->itemsize, - self->ob_size, fp) != self->ob_size) { + if (fwrite(self->ob_item, self->ob_descr->itemsize, + self->ob_size, fp) != (size_t)self->ob_size) { PyErr_SetFromErrno(PyExc_IOError); clearerr(fp); return NULL;
